Quantcast
Channel: Directory Services forum
Viewing all articles
Browse latest Browse all 31638

ADFS - WIF issue in load balanced environment - Parameter name: certificate] Microsoft.IdentityModel.Web.RsaEncryptionCookieTransform..ctor(X509Certificate2 certificate)

$
0
0

Hi 

We are using passive claims based authentication on a load balanced app with sticky sessions enabled. We want to get rid of sticky sessions and to do this As suggested by some article on msdn site, I added this piece of code to my global.asax file to change the encryption from DPAPI to RSA.

 void FederatedAuthentication_ServiceConfigurationCreated(object sender,Microsoft.IdentityModel.Web.Configuration.ServiceConfigurationCreatedEventArgs e)

        {            Log.Debug("FederatedAuthentication_ServiceConfigurationCreated");            List<CookieTransform> sessionTransforms = new List<CookieTransform>(new CookieTransform[] { new DeflateCookieTransform(),                  new RsaEncryptionCookieTransform(e.ServiceConfiguration.ServiceCertificate),                new RsaSignatureCookieTransform(e.ServiceConfiguration.ServiceCertificate)  });            SessionSecurityTokenHandler sessionHandler = new SessionSecurityTokenHandler(sessionTransforms.AsReadOnly());            e.ServiceConfiguration.SecurityTokenHandlers.AddOrReplace(sessionHandler);            Microsoft.IdentityModel.Web.FederatedAuthentication.WSFederationAuthenticationModule.AuthorizationFailed += WSFederationAuthenticationModule_AuthorizationFailed;        }

After adding this code, I receive the below error:

Server Error in '/' Application.

Value cannot be null.
Parameter name: certificate

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: certificate

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[ArgumentNullException: Value cannot be null.
Parameter name: certificate]
   Microsoft.IdentityModel.Web.RsaEncryptionCookieTransform..ctor(X509Certificate2 certificate) +193
   Nasdaq.Gcs.Gnw.Editorial.UI.MvcApplication.FederatedAuthentication_ServiceConfigurationCreated(Object sender, ServiceConfigurationCreatedEventArgs e) in f:\Builds\1\Dragon\Editorial-main-WixDeploy\Sources\Gnw\Newswire\main\Editorial\Editorial.UI\Global.asax.cs:108
   Microsoft.IdentityModel.Web.FederatedAuthentication.get_ServiceConfiguration() +184
   Microsoft.IdentityModel.Web.HttpModuleBase.Init(HttpApplication context) +17
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +530
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Value cannot be null.
Parameter name: certificate]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968244
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12807949

Did anyone else experience this error and found a solution? if so please guide me.  


RKD


RKD


Viewing all articles
Browse latest Browse all 31638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>