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); }
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); }