Package org.wso2.carbon.core.common

Examples of org.wso2.carbon.core.common.AuthenticationException


            stub.logout();
            session.removeAttribute(ServerConstants.ADMIN_SERVICE_AUTH_TOKEN);
        } catch (java.lang.Exception e) {
            String msg = "Error occurred while logging out";
            log.error(msg, e);
            throw new AuthenticationException(msg, e);
        }
    }
View Full Code Here


                ssoSessionManager.addSessionMapping(getSessionIndexFromResponse(samlResponse),
                                                    session.getId());
            }
        } catch (SAML2SSOUIAuthenticatorException e) {
            log.error("Error when authenticating the user : " + username, e);
            throw new AuthenticationException("Error when authenticating the user : " + username, e);
        }
        catch (Exception e) {
            log.error("Error when creating SAML2SSOAuthenticationClient.", e);
            throw new AuthenticationException("Error when creating SAML2SSOAuthenticationClient.", e);
        }
        return isAuthenticated;
    }
View Full Code Here

        userName = request.getParameter("username");
        ssoSessionId = request.getParameter(SSO_SESSION_ID);
        try {
            return super.authenticate(request, userName, ssoSessionId, false);
        } catch (RemoteException e) {
            throw new AuthenticationException(e.getMessage(), e);
        }
    }
View Full Code Here

        try {
            return getLoggedUserInfo(stub.getUserInfo());
        } catch (Exception e) {
            String msg = "Error occurred while getting system permissions of user";
            log.error(msg, e);
            throw new AuthenticationException(msg, e);
        }
    }
View Full Code Here

        String value = request.getParameter(AbstractCarbonUIAuthenticator.REMEMBER_ME);

        boolean isRememberMe = false;

        if (userName == null || password == null) {
            throw new AuthenticationException("Invalid username or password provided.");
        }

        if (value != null && value.equals(AbstractCarbonUIAuthenticator.REMEMBER_ME)) {
            isRememberMe = true;
        }
View Full Code Here

            CarbonUtils.setBasicAccessSecurityHeaders(defaultCredentials.getUserName(),
                    defaultCredentials.getPassword(), isRememberMe, client);
            return defaultCredentials.getUserName();
        }

        throw new AuthenticationException("Invalid user credentials.");
    }
View Full Code Here

        if (transportHeaders != null) {
            String cookieValue = (String) transportHeaders.get("RememberMeCookieValue");
            String cookieAge = (String) transportHeaders.get("RememberMeCookieAge");

            if (cookieValue == null || cookieAge == null) {
                throw new AuthenticationException("Unable to load remember me date from response. "
                        + "Cookie value or cookie age or both are null");
            }

            if (log.isDebugEnabled()) {
                log.debug("Cookie value returned " + cookieValue + " cookie age " + cookieAge);
View Full Code Here

                if (isAutenticated) {
                    return defaultCredentials.getUserName();
                }
            }

            throw new AuthenticationException("Invalid user credentials.");

        } catch (AxisFault e) {
            throw new AuthenticationException(e.getMessage(), e);
        }

    }
View Full Code Here

        HttpSession session = request.getSession();
        LoggedUserInfoAdminStub stub;
        String loggedinUser = null;

        if (backendServerURL == null) {
            throw new AuthenticationException("Server not initialized properly.");
        }

        try {

            stub = getLoggedUserInfoAdminStub(backendServerURL, session);
            ServiceClient client = stub._getServiceClient();

            // In side this method - Authenticators should complete the authentication with the
            // back-end service Or - it should set the required authentication headers, there are
            // required in future service calls. Also each Authenticator should know how to handle
            // the Remember Me logic.
            loggedinUser = doAuthentication(credentials, rememberMe, client, request);

            if (isAdminCookieSet()) {
                // If the UI Authenticator takes the responsibility of setting the Admin Cookie,it
                // has to set the value in the session with the key
                // ServerConstants.ADMIN_SERVICE_AUTH_TOKEN.
                client.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING,
                        session.getAttribute(ServerConstants.ADMIN_SERVICE_AUTH_TOKEN));
            }

            // By now, user is authenticated or proper authentication headers been set. This call
            // set retrieve user authorization information from the back-end.
            setUserAuthorizationInfo(stub, session);

            if (!isAdminCookieSet()) {
                // If authentication successful set the cookie.
                // Authenticators them selves have not set the cookie.
                setAdminCookie(session, client, null);
            }

            // Process remember me data in reply
            if (rememberMe) {
                OperationContext operationContext = client.getLastOperationContext();
                MessageContext inMessageContext;
                Map transportHeaders;
                inMessageContext = operationContext
                        .getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN);
                transportHeaders = (Map) inMessageContext
                        .getProperty(MessageContext.TRANSPORT_HEADERS);
                handleRememberMe(transportHeaders, request);
            }

            onSuccessAdminLogin(request, loggedinUser);
           
        } catch (RemoteException e) {
            throw new AuthenticationException(e.getMessage(), e);
        } catch (Exception e) {
            throw new AuthenticationException(
                    "Exception occurred while accessing user authorization info", e);
        }
    }
View Full Code Here

    }
    request.setAttribute(AbstractCarbonUIAuthenticator.USERNAME, userName);

        String serverURL = getBackendUrl(request);
        if (serverURL == null) {
            throw new AuthenticationException("Server not initialized properly.");
        }

        String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);

        // For local transport, cookie might be null.
View Full Code Here

TOP

Related Classes of org.wso2.carbon.core.common.AuthenticationException

Copyright © 2018 www.massapicom. 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.