public void ProcessResponse()
{
if (string.IsNullOrEmpty(this.federationContext.IssuerName))
{
throw new InvalidOperationException("The context cookie was not found. Try to re-login");
}
var issuer = this.configuration.RetrieveIssuer(new Uri(this.federationContext.IssuerName));
var handler = this.protocolDiscovery.RetrieveProtocolHandler(issuer);
if (handler == null)
throw new InvalidOperationException();
IClaimsIdentity identity = handler.ProcessSignInResponse(
this.federationContext.Realm,
this.federationContext.OriginalUrl,
this.HttpContext);
IClaimsIdentity outputIdentity = UpdateIssuer(identity, this.multiProtocolServiceProperties.Identifier.ToString(), issuer.Identifier.ToString());
outputIdentity.Claims.Add(new Claim(ClaimTypes.AuthenticationMethod, issuer.Identifier.ToString(), ClaimValueTypes.String, this.multiProtocolServiceProperties.Identifier.ToString()));
outputIdentity.Claims.Add(new Claim(ClaimTypes.AuthenticationInstant, DateTime.Now.ToString("o"), ClaimValueTypes.Datetime, this.multiProtocolServiceProperties.Identifier.ToString()));
var sessionToken = new SessionSecurityToken(new ClaimsPrincipal(new IClaimsIdentity[] { outputIdentity }));
FederatedAuthentication.WSFederationAuthenticationModule.SetPrincipalAndWriteSessionToken(sessionToken, true);
Response.Redirect(this.federationContext.OriginalUrl, false);
HttpContext.ApplicationInstance.CompleteRequest();
}