Examples of AuthenticationAdminClient


Examples of org.wso2.carbon.authenticator.proxy.AuthenticationAdminClient

    public String doAuthentication(Object credentials, boolean isRememberMe, ServiceClient client,
            HttpServletRequest request) throws AuthenticationException {

        DefaultAuthenticatorCredentials defaultCredentials = (DefaultAuthenticatorCredentials) credentials;
        // call AuthenticationAdmin, since BasicAuth are not validated for LocalTransport
        AuthenticationAdminClient authClient;
        try {
            authClient = getAuthenticationAdminCient(request);
            boolean isAutenticated = false;
            if (isRememberMe && defaultCredentials.getUserName() != null
                    && defaultCredentials.getPassword() != null) {
                RememberMeData rememberMe;
                rememberMe = authClient.loginWithRememberMeOption(defaultCredentials.getUserName(),
                        defaultCredentials.getPassword(), "127.0.0.1");
                isAutenticated = rememberMe.getAuthenticated();
                if (isAutenticated) {
                    request.setAttribute(CarbonConstants.REMEMBER_ME_COOKIE_VALUE,
                            rememberMe.getValue());
                    request.setAttribute(CarbonConstants.REMEMBER_ME_COOKIE_AGE, new Integer(
                            rememberMe.getMaxAge()).toString());
                    return defaultCredentials.getUserName();
                }
            } else if (isRememberMe) {
                // This is to login with Remember Me.
                Cookie[] cookies = request.getCookies();
                if (cookies != null) {
                    for (Cookie cookie : cookies) {
                        if (cookie.getName().equals(CarbonConstants.REMEMBER_ME_COOKE_NAME)) {
                            isAutenticated = authClient
                                    .loginWithRememberMeCookie(cookie.getValue());
                            if (isAutenticated) {
                                String cookieValue = cookie.getValue();
                                return getUserNameFromCookie(cookieValue);
                            }
                        }
                    }
                }
            } else {
                isAutenticated = authClient.login(defaultCredentials.getUserName(),
                        defaultCredentials.getPassword(), "127.0.0.1");
                if (isAutenticated) {
                    return defaultCredentials.getUserName();
                }
            }
View Full Code Here

Examples of org.wso2.carbon.authenticator.proxy.AuthenticationAdminClient

        ConfigurationContext configContext = (ConfigurationContext) servletContext
                .getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);

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

        return new AuthenticationAdminClient(configContext, backendServerURL, cookie, session, true);
    }
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.