Examples of FESessionBean


Examples of org.wso2.carbon.identity.sso.saml.ui.session.mgt.FESessionBean

                                           username, password, ssoTokenID,
                                           ssoServiceClient);
            }
        } catch (IdentityException e) { // in case of an error, redirect them to notifications page with an error msg.
            FESessionManager sessionManager = FESessionManager.getInstance();
            String authSessionID = sessionManager.addNewSession(new FESessionBean("Server Error", "Please try again later."));
            response.sendRedirect(getAdminConsoleURL(request) + "sso-saml/notification_page.jsp?" +
                                  SAMLSSOProviderConstants.FE_SESSION_KEY + "=" + authSessionID);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.identity.sso.saml.ui.session.mgt.FESessionBean

                                            SAMLSSOServiceClient ssoServiceClient)
            throws IdentityException, IOException {

        FESessionManager sessionManager = FESessionManager.getInstance();
        String authSessionID = httpServletRequest.getParameter(SAMLSSOProviderConstants.FE_SESSION_KEY);
        FESessionBean sessionBean = sessionManager.getFESessionBean(authSessionID);
        SAMLSSOReqValidationResponseDTO validationResponseDTO = null;
        if (sessionBean != null) {
            if (sessionBean.getSessionBean() instanceof SAMLSSOReqValidationResponseDTO) {
                validationResponseDTO = (SAMLSSOReqValidationResponseDTO) sessionBean.getSessionBean();
            }
        }
        else{
            String errorSessionId = sessionManager.addNewSession(new FESessionBean("This authenticated session is expired.", "Please sign-in again."));
            httpServletResponse.sendRedirect(getAdminConsoleURL(httpServletRequest) + "sso-saml/notification_page.jsp?" +
                                  SAMLSSOProviderConstants.FE_SESSION_KEY + "=" + errorSessionId);
            return;
        }
        // Create SAMLSSOAuthnReqDTO using a SAMLSSOReqValidationResponseDTO
        SAMLSSOAuthnReqDTO authnReqDTO = new SAMLSSOAuthnReqDTO();
        authnReqDTO.setAssertionConsumerURL(validationResponseDTO.getAssertionConsumerURL());
        authnReqDTO.setId(validationResponseDTO.getId());
        authnReqDTO.setIssuer(validationResponseDTO.getIssuer());
        authnReqDTO.setPassword(password);
        authnReqDTO.setUsername(username);
        authnReqDTO.setSubject(validationResponseDTO.getSubject());
        authnReqDTO.setRpSessionId(validationResponseDTO.getRpSessionId());
        authnReqDTO.setAssertionString(validationResponseDTO.getAssertionString());

        // authenticate the user
        SAMLSSORespDTO authRespDTO = ssoServiceClient.authenticate(authnReqDTO, ssoTokenID);

        if (authRespDTO.getSessionEstablished()) {  // authentication is SUCCESSFUL
            storeSSOTokenCookie(ssoTokenID, httpServletRequest, httpServletResponse);
            String respSessionAuthID = sessionManager.addNewSession(new FESessionBean(authRespDTO, sessionBean.getRelayState()));
            sessionManager.removeSession(authSessionID);    // remove the SAMLSSORespDTO
            httpServletResponse.sendRedirect(getAdminConsoleURL(httpServletRequest) + "sso-saml/redirect_ajaxprocessor.jsp?" + SAMLSSOProviderConstants.FE_SESSION_KEY + "=" + respSessionAuthID);
        } else {    // authentication FAILURE
            validationResponseDTO.setValid(false);
            httpServletResponse.sendRedirect(calculateLoginPage(
View Full Code Here

Examples of org.wso2.carbon.identity.sso.saml.ui.session.mgt.FESessionBean

    }

    private void handleLogout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
            throws IdentityException, IOException {
        FESessionManager sessionManager = FESessionManager.getInstance();
        String sessionId = sessionManager.addNewSession(new FESessionBean("You have been successfully signed out."
                , "All the other authenticated sessions are terminated."));
        httpServletResponse.sendRedirect(getAdminConsoleURL(httpServletRequest) + "sso-saml/notification_page.jsp?" +
                                         SAMLSSOProviderConstants.FE_SESSION_KEY + "=" + sessionId);
    }
View Full Code Here

Examples of org.wso2.carbon.identity.sso.saml.ui.session.mgt.FESessionBean

        FESessionManager sessionManager = FESessionManager.getInstance();
        // If it is a login request.
        if (!signInRespDTO.getLogOutReq()) {
            //  an authentication context has not been already established, redirect user to a login page.
            if (signInRespDTO.getValid() && signInRespDTO.getResponse() == null) {
                String sessionID = sessionManager.addNewSession(new FESessionBean(signInRespDTO, relayState));
                httpServletResponse.sendRedirect(calculateLoginPage(
                        getAdminConsoleURL(httpServletRequest), signInRespDTO.getLoginPageURL())+ "?" +
                                                 SAMLSSOProviderConstants.FE_SESSION_KEY + "=" + sessionID);

                // an auth. context has been already established. So redirect users back to ACS.
            } else if (signInRespDTO.getResponse() != null) {
                String sessionID = sessionManager.addNewSession(new FESessionBean(signInRespDTO, relayState));
                if(SAMLSSOProviderConstants.AuthnModes.OPENID.equals(authMode)){
                    storeSSOTokenCookie(ssoTokenID, httpServletRequest, httpServletResponse);
                }
                httpServletResponse.sendRedirect(getAdminConsoleURL(httpServletRequest) + "sso-saml/redirect_ajaxprocessor.jsp?" + SAMLSSOProviderConstants.FE_SESSION_KEY + "=" + sessionID);
            }
        } else {     // in case of a logout request
            String sessionID = sessionManager.addNewSession(new FESessionBean(signInRespDTO, relayState));
            LogoutRequestSender.getInstance().sendLogoutRequests(signInRespDTO.getLogoutRespDTO());
            httpServletResponse.sendRedirect(getAdminConsoleURL(httpServletRequest) + "sso-saml/redirect_ajaxprocessor.jsp?" + SAMLSSOProviderConstants.FE_SESSION_KEY + "=" + sessionID);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.