예제 #1
1
파일: WSFederation.cs 프로젝트: pepipe/ISEL
        public void HandleRequestResponse()
        {
            if (testMode)
                GenerateTestClaims();
            else
            {
                // If we don't have the google resouce (cookie of user's google info) then let's get it
                if (this.googleResource == null)
                    RequestGoogleResouce();

                GenerateClaims();
            }

            SecurityTokenServiceConfiguration tokenConf = new SimpleSecurityTokenServiceConfiguration();
            // simulate successful authentication
            ClaimsIdentity identity = new ClaimsIdentity(AuthenticationTypes.Federation);
            identity.AddClaim(new Claim(ClaimTypes.Name, "WS-IdP"));
            ClaimsPrincipal principal = new ClaimsPrincipal(identity);
            // Create security token service instance

            SecurityTokenService sts = new SimpleSecurityTokenService(tokenConf, userClaims);

            // Use facade class FederatedPassiveSecurityTokenServiceOperations to execute WS-Federation protocol
            FederatedPassiveSecurityTokenServiceOperations.ProcessRequest(
                this.request,
                principal,
                sts,
                this.response);
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SecurityTokenServiceConfiguration tokenConf = new SimpleSecurityTokenServiceConfiguration();

            // simulate successful authentication
            ClaimsIdentity identity = new ClaimsIdentity(AuthenticationTypes.Federation);
            identity.AddClaim(new Claim(ClaimTypes.Name, "WS-IdP"));
            ClaimsPrincipal principal = new ClaimsPrincipal(identity);
            // Create security token service instance
            ClaimsIdentity testClaims = GenerateTestClaims();
            SecurityTokenService sts = new SimpleSecurityTokenService(tokenConf, testClaims);

            // Use facade class FederatedPassiveSecurityTokenServiceOperations to execute WS-Federation protocol
            FederatedPassiveSecurityTokenServiceOperations.ProcessRequest(
                HttpContext.Current.Request,
                principal,
                sts,
                HttpContext.Current.Response);
        }