Package org.wso2.carbon.authenticator.proxy

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


        }

        public String login() throws UserStoreException {
            try {
                synchronized (stub) {
                    AuthenticationAdminClient client = new AuthenticationAdminClient(
                            UserMgtWSAPIDSComponent.getCcServiceInstance().getClientConfigContext(),
                            url, null, null, false);
                    boolean isLogin = client.login(userName, password, "127.0.0.1");
                    if (isLogin) {
                        return client.getAdminCookie();
                    } else {
                        log.error("Error login in tenant manager");
                        throw new UserStoreException("Error login in tenant manager");
                    }
                }
View Full Code Here

        String userName = realmConfig.getRealmProperty(WSRemoteUserMgtConstants.USER_NAME);
        String password = realmConfig.getRealmProperty(WSRemoteUserMgtConstants.PASSWORD);
        try {
            ConfigurationContext configContext = (ConfigurationContext) UserMgtWSAPIDSComponent
                    .getCcServiceInstance().getClientConfigContext();
            AuthenticationAdminClient client = new AuthenticationAdminClient(configContext,
                                                                             realmConfig.getRealmProperty(WSRemoteUserMgtConstants.SERVER_URL),
                                                                             sessionCookie, null, false);
            boolean isLogin = client.login(userName, password, "127.0.0.1"); // TODO
            if (isLogin) {
                sessionCookie = client.getAdminCookie();
            }
        } catch (Exception e) {
            throw new UserStoreException("Error" + e.getMessage(), e);
        }
    }
View Full Code Here

    }

    public static String login(String serverUrl, String userName, String password) throws Exception {
        String sessionCookie = null;
        try {
            AuthenticationAdminClient client =
                    new AuthenticationAdminClient(Util.getConfigurationContextService()
                            .getClientConfigContext(), serverUrl, null, null, false);
            // TODO : get the correct IP
            boolean isLogin = client.login(userName, password, "127.0.0.1");
            if (isLogin) {
                sessionCookie = client.getAdminCookie();
            }
        } catch (Exception e) {
            throw new Exception("Error in login to throttling manager. server: " + serverUrl +
                    "username: " + userName + ".", e);
        }
View Full Code Here

    public static String login(String serverUrl, String userName, String password) throws
                                                                                   UserStoreException {
        String sessionCookie = null;
        try {
            AuthenticationAdminClient client =
                    new AuthenticationAdminClient(DataHolder.getInstance().getClientConfigContext(),
                                                  serverUrl, null, null, false);
            //TODO : get the correct IP
            boolean isLogin = client.login(userName, password, "127.0.0.1");
            if (isLogin) {
                sessionCookie = client.getAdminCookie();
            }
        } catch (Exception e) {
            throw new UserStoreException("Error in login to the server server: " + serverUrl +
                                         "username: " + userName + ".", e);
        }
View Full Code Here

    //case of 2_0_X
    private boolean authenticateWithServer_Carbon_3_0_0(ServerDO server) {
        boolean isLoggedIn = false;

        try {
            AuthenticationAdminClient authenticationAdminClient_3_0_0 =
                    new AuthenticationAdminClient(BAMUtil.getConfigurationContextService().getClientConfigContext(),
                            server.getServerURL() + "/services/", null, null, false);

            isLoggedIn = authenticationAdminClient_3_0_0.login(server.getUserName(), server.getPassword(),
                    NetworkUtils.getLocalHostname());

            if (isLoggedIn) {
                getSessionCache().addSessionString(server.getServerURL(),authenticationAdminClient_3_0_0.getAdminCookie());
            }
        } catch (Throwable ignore) {
            log.debug("Carbon 300 authentication failed with server: " + server.toString(), ignore);
        }
View Full Code Here

    }

    public static String login(String serverUrl, String userName, String password) throws Exception {
        String sessionCookie = null;
        try {
            AuthenticationAdminClient client =
                    new AuthenticationAdminClient(ThrottlingAgentServiceComponent.getThrottlingAgent().getConfigurationContextService()
                            .getClientConfigContext(), serverUrl, null, null, false);
            // TODO : get the correct IP
            boolean isLogin = client.login(userName, password, "127.0.0.1");
            if (isLogin) {
                sessionCookie = client.getAdminCookie();
            }
        } catch (Exception e) {
            throw new Exception("Error in login to throttling manager. server: " + serverUrl +
                    "username: " + userName + ".", e);
        }
View Full Code Here

   
    private String login(String serverUrl, String userName,
                               String password, ConfigurationContext confContext) throws UserStoreException {
        String sessionCookie = null;
        try {
            AuthenticationAdminClient client =
                    new AuthenticationAdminClient(confContext, serverUrl, null, null, false);
            //TODO : get the correct IP
            boolean isLogin = client.login(userName, password, "127.0.0.1");
            if (isLogin) {
                sessionCookie = client.getAdminCookie();
            }
        } catch (Exception e) {
            throw new UserStoreException("Error in login to the server server: " + serverUrl +
                                         "username: " + userName + ".", e);
        }
View Full Code Here

    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

        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

Related Classes of org.wso2.carbon.authenticator.proxy.AuthenticationAdminClient

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.