I use WIF to authenticate our new website, STS is based on a starter implementation.
For this to work correctly in a load balancing environment, I used the following in global.asax to override the default certificate behavior.
void onServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e) { 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); }
It all works, they just find it, and people successfully use the system, but from time to time we get an explosion:
ID1014: The signature is not valid. The data may have been tampered with.
in the event logs, so I turned on WIF tracing and saw the following in the log.
ID1074: CryptographicException occurred while trying to encrypt a cookie using the ProtectedData API (see internal exception for details). If you are using IIS 7.5, this could be because loadUserProfile in the application pool is set to false.
I have a feeling that this leads me down a dark lane, as I thought, because I changed the implementation to use RSA, it should not touch me.
Any ideas to help me?
wif windows-identity federated-identity ws-federation
Rubbleord
source share