/// <summary> /// Action performed during logout. /// </summary> /// <param name="handler">The handler.</param> /// <param name="context">The context.</param> /// <param name="idpInitiated">if set to <c>true</c> IDP is initiated.</param> public void LogoutAction(AbstractEndpointHandler handler, HttpContext context, bool idpInitiated) { if (!idpInitiated) { handler.DoRedirect(context); } }
/// <summary> /// Action performed during SignOn. /// </summary> /// <param name="handler">The handler initiating the call.</param> /// <param name="context">The current http context.</param> /// <param name="assertion">The SAML assertion of the currently logged in user.</param> public void SignOnAction(AbstractEndpointHandler handler, HttpContext context, Saml20Assertion assertion) { var idpKey = _stateService.Get<string>(Saml20SignonHandler.IdpLoginSessionKey); var signOnHandler = handler as Saml20SignonHandler; if (signOnHandler == null) { throw new ArgumentException("Endpoint handler must be of type Saml20SignonHandler.", "handler"); } var identityProvider = signOnHandler.RetrieveIDPConfiguration(idpKey); if (identityProvider.CommonDomainCookie != null) { var values = identityProvider.CommonDomainCookie.AllKeys; var idpEndpoint = values.FirstOrDefault(x => x == IDPCookieWriterEndPoint); if (idpEndpoint == null) { throw new Saml20Exception(@"Please specify """ + IDPCookieWriterEndPoint + @""" in CommonDomainCookie element."); } var localReturnPoint = values.FirstOrDefault(x => x == LocalReturnUrl); if (localReturnPoint == null) { throw new Saml20Exception(@"Please specify """ + LocalReturnUrl + @""" in CommonDomainCookie element."); } context.Response.Redirect(idpEndpoint + "?" + TargetResource + "=" + localReturnPoint); } else { handler.DoRedirect(context); } }
/// <summary> /// Action performed during SignOn. /// </summary> /// <param name="handler">The handler initiating the call.</param> /// <param name="context">The current http context.</param> /// <param name="assertion">The SAML assertion of the currently logged in user.</param> public void SignOnAction(AbstractEndpointHandler handler, HttpContext context, Saml20Assertion assertion) { FormsAuthentication.SetAuthCookie(Saml20PrincipalCache.GetPrincipal().Identity.Name, false); }
/// <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, HttpContext context, bool idpInitiated) { FormsAuthentication.SignOut(); }
/// <summary> /// Action performed during SignOn. /// </summary> /// <param name="handler">The handler initiating the call.</param> /// <param name="context">The current http context.</param> /// <param name="assertion">The SAML assertion of the currently logged in user.</param> public void SignOnAction(AbstractEndpointHandler handler, HttpContext context, Saml20Assertion assertion) { var signonhandler = (Saml20SignonHandler)handler; Saml20PrincipalCache.AddPrincipal(Saml20Identity.InitSaml20Identity(assertion, signonhandler.RetrieveIDPConfiguration(_stateService.Get<string>(Saml20AbstractEndpointHandler.IdpTempSessionKey)))); }
/// <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, HttpContext context, bool idpInitiated) { Saml20PrincipalCache.Clear(); }
/// <summary> /// Action performed during SignOn. /// </summary> /// <param name="handler">The handler initiating the call.</param> /// <param name="context">The current http context.</param> /// <param name="assertion">The SAML assertion of the currently logged in user.</param> public void SignOnAction(AbstractEndpointHandler handler, HttpContext context, Saml20Assertion assertion) { handler.DoRedirect(context); }