static void OnServiceConfigurationCreated(object sender, FederationConfigurationCreatedEventArgs e) { var cookieTransforms = new CookieTransform[] { new DeflateCookieTransform(), new RsaEncryptionCookieTransform(e.FederationConfiguration.ServiceCertificate), new RsaSignatureCookieTransform(e.FederationConfiguration.ServiceCertificate) }; var sessionTransforms = new List <CookieTransform>(cookieTransforms); var sessionHandler = new SessionSecurityTokenHandler(sessionTransforms.AsReadOnly()); e.FederationConfiguration.IdentityConfiguration.SecurityTokenHandlers.AddOrReplace(sessionHandler); }
/// <summary> /// Initializes a new instance of the <see cref="X509CertificateDataProtector"/> class. /// </summary> /// <param name="certificate">The certificate.</param> public X509CertificateDataProtector(X509Certificate2 certificate) { _encrypt = new RsaEncryptionCookieTransform(certificate); _sign = new RsaSignatureCookieTransform(certificate); }