I have an existing MVC application integrated with Kentor for SAML authentication, currently using Forms Authentication. I am trying to deploy this application to AWS server instances while using Okta as the Identity Provider (IdP). The application runs smoothly in my local environment on AppStream, where I can debug it without issues. However, after deploying to the AWS server instances, I encountered the following exception
**Inner Exception Type: System.Security.Cryptography.CryptographicExceptionInner Exception: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.Inner Source:
However, when accessing the URL https://my-app-aps.yyy.com/AuthServices/Acs, we encounter the following error. Interestingly, after refreshing the page multiple times, it eventually loads correctly
This looks like an issue with the SessionAuthenticationModule, which is not part of the Sustainsys.Saml2 package (although it is used by the Saml2 package)
I have an existing MVC application integrated with Kentor for SAML authentication, currently using Forms Authentication. I am trying to deploy this application to AWS server instances while using Okta as the Identity Provider (IdP). The application runs smoothly in my local environment on AppStream, where I can debug it without issues. However, after deploying to the AWS server instances, I encountered the following exception **Inner Exception Type: System.Security.Cryptography.CryptographicExceptionInner Exception: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.Inner Source:
I identified this issue and follow this https://github.com/Sustainsys/Saml2/issues/427 and the issue was gone.
However, when accessing the URL https://my-app-aps.yyy.com/AuthServices/Acs, we encounter the following error. Interestingly, after refreshing the page multiple times, it eventually loads correctly
[CryptographicException: Error occurred during a cryptographic operation.] System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2 func, Byte[] input) +174 System.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[] cookie, Boolean outbound) +179 System.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver) +793 System.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(Byte[] token, SecurityTokenResolver tokenResolver) +90 System.IdentityModel.Services.SessionAuthenticationModule.ReadSessionTokenFromCookie(Byte[] sessionCookie) +531 System.IdentityModel.Services.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken& sessionToken) +266 System.IdentityModel.Services.SessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +148 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +142 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +75 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +93