Skip to content

Instantly share code, notes, and snippets.

@sandrinodimattia
Created July 19, 2012 22:55
Show Gist options
  • Save sandrinodimattia/3147435 to your computer and use it in GitHub Desktop.
Save sandrinodimattia/3147435 to your computer and use it in GitHub Desktop.
FederatedAuthentication
protected void Application_Start()
{
...
FederatedAuthentication.ServiceConfigurationCreated += OnServiceConfigurationCreated;
}
private void OnServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e)
{
var sessionTransforms = new List<CookieTransform>(new CookieTransform[]
{
new DeflateCookieTransform(),
new RsaEncryptionCookieTransform(e.ServiceConfiguration.ServiceCertificate),
new RsaSignatureCookieTransform(e.ServiceConfiguration.ServiceCertificate)
});
var sessionHandler = new SessionSecurityTokenHandler(sessionTransforms.AsReadOnly());
e.ServiceConfiguration.SecurityTokenHandlers.AddOrReplace(sessionHandler);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment