示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            var config = new FederatedIdentityConfiguration();
            var tokenXml = GetTokenXml(context.Request);
            var handlers = CreateSecurityTokenHandlerCollection(config.Realm, config.CertificateThumbprint);
            var token = handlers.ReadToken(XmlReader.Create(new StringReader(tokenXml)));
            var identities = handlers.ValidateToken(token);
            var claims = ClaimsPrincipal.CreateFromIdentities(identities);

            IClaimsIdentity identity = claims.Identities[0];

            FederatedAuthentication.SessionAuthenticationModule.WriteSessionTokenToCookie(new SessionSecurityToken(claims, null, token.ValidFrom, token.ValidTo));

            string redirect = "~/";
            if (context.Request["wctx"] != null)
                redirect = context.Request["wctx"];

            context.Response.Redirect(redirect);
            context.ApplicationInstance.CompleteRequest();
        }
 public SiteMonitRNotificationHub(FederatedIdentityConfiguration authConfig)
 {
     this.authConfig = authConfig;
 }