Exemple #1
0
        private void PostAcquireRequestState(object sender, EventArgs e)
        {
            HttpApplication application = (HttpApplication)sender;
            HttpContext     context     = application.Context;

            SSOAgentConfig          ssoAgentConfig  = (SSOAgentConfig)HttpContext.Current.Application[SSOAgentConstants.CONFIG_BEAN_NAME];
            SSOAgentRequestResolver requestResolver = new SSOAgentRequestResolver(context.Request, ssoAgentConfig);

            // Single logout request, as a result of some other application.
            if (requestResolver.IsSLORequest())
            {
                SAML2SSOManager samlSSOManager = new SAML2SSOManager(ssoAgentConfig);
                samlSSOManager.ProcessSAMLRequest(context);

                context.Response.Clear();
                context.Response.StatusCode = 200;
                context.Response.End();
                return;
            }

            // Requesting log out by the currently running application.
            else if (requestResolver.IsSLOURL())
            {
                SAML2SSOManager samlSSOManager = new SAML2SSOManager(ssoAgentConfig);

                if (ssoAgentConfig.Saml2.HttpBinding == SSOAgentConstants.SAML2SSO.SAML2_REDIRECT_BINDING_URI)
                {
                    context.Response.Redirect(samlSSOManager.BuildRedirectBindingLogoutRequest());
                }
                else
                {
                    samlSSOManager.SendPostBindingLogoutRequest(context);
                }
            }

            // Requests with SAMLResponse param is handled by below block.
            else if (requestResolver.IsSAML2SSOResponse(context.Request))
            {
                SAML2SSOManager samlSSOManager = new SAML2SSOManager(ssoAgentConfig);
                samlSSOManager.ProcessSAMLResponse(context.Request, context.Response);
            }

            else if (requestResolver.IsSAML2SSOURL())
            {
                HttpContext.Current.Session["loginRequestedFrom"] = GetLoginRequstedLocation(context.Request);

                SAML2SSOManager samlSSOManager = new SAML2SSOManager(ssoAgentConfig);

                if (ssoAgentConfig.Saml2.HttpBinding == SSOAgentConstants.SAML2SSO.SAML2_REDIRECT_BINDING_URI)
                {
                    context.Response.Redirect(samlSSOManager.BuildRedirectBindingLoginRequest());
                }
                else
                {
                    samlSSOManager.SendPostBindingLoginRequest(context);
                }
            }
        }
Exemple #2
0
 public SSOAgentRequestResolver(HttpRequest request, SSOAgentConfig ssoAgentConfig)
 {
     this.request        = request;
     this.ssoAgentConfig = ssoAgentConfig;
 }
 public OIDCManager(SSOAgentConfig ssoAgentConfig)
 {
     this.ssoAgentConfig = ssoAgentConfig;
 }
Exemple #4
0
 public SAML2SSOManager(SSOAgentConfig ssoAgentConfig)
 {
     this.ssoAgentConfig = ssoAgentConfig;
 }