/// <summary> /// Handles a request. /// </summary> /// <param name="context">The context.</param> protected override void Handle(SamlHttpContext context) { Trace.TraceMethodCalled(GetType(), "Handle()"); try { //Some IdP's are known to fail to set an actual value in the SOAPAction header //so we just check for the existence of the header field. if (Array.Exists(context.Request.Headers.AllKeys, delegate(string s) { return(s == SOAPConstants.SOAPAction); })) { HandleSOAP(context, context.Request.InputStream); return; } if (!string.IsNullOrEmpty(context.Request.Params["SAMLart"])) { HandleArtifact(context); return; } if (!string.IsNullOrEmpty(context.Request.Params["SAMLResponse"])) { HandleResponse(context); } else if (!string.IsNullOrEmpty(context.Request.Params["SAMLRequest"])) { HandleRequest(context); } else { IDPEndPoint idpEndpoint = null; Saml20AssertionLite saml20AssertionLite = Saml20PrincipalCache.GetSaml20AssertionLite(); if (saml20AssertionLite != null) { idpEndpoint = RetrieveIDPConfiguration(saml20AssertionLite.Issuer); } if (idpEndpoint == null) { context.Logout(); //FormsAuthentication.SignOut(); HandleError(context, Resources.UnknownLoginIDP); } TransferClient(idpEndpoint, context); } } catch (Exception e) { //ThreadAbortException is thrown by response.Redirect so don't worry about it if (e is ThreadAbortException) { throw; } HandleError(context, e.Message); } }
/// <summary> /// Action performed during logout. /// </summary> /// <param name="handler">The handler.</param> /// <param name="context">The context.</param> /// <param name="IdPInitiated">During IdP initiated logout some actions such as redirecting should not be performed</param> public void LogoutAction(AbstractEndpointHandler handler, SamlHttpContext context, bool IdPInitiated) { FormsAuthentication.SignOut(); context.Logout(); }