Package com.sun.enterprise.admin.util

Examples of com.sun.enterprise.admin.util.AuthenticationInfo


        public HttpURLConnection getHttpURLConnection(URL url) throws IOException {
            final Domain domain = habitat.getComponent(Domain.class);
            SecureAdmin secureAdmin = domain.getSecureAdmin();
            final String certAlias = SecureAdmin.Util.isUsingUsernamePasswordAuth(secureAdmin) ? null : SecureAdmin.Util.DASAlias(secureAdmin);
            HttpConnectorAddress httpConnectorAddress = new HttpConnectorAddress(habitat.getComponent(SSLUtils.class).getAdminSocketFactory(certAlias, "TLS"));
            AuthenticationInfo authenticationInfo = authenticationInfo(habitat, secureAdmin);
            if (authenticationInfo != null) {
                httpConnectorAddress.setAuthenticationInfo(authenticationInfo);
            }
            HttpURLConnection httpURLConnection = (HttpURLConnection) httpConnectorAddress.openConnection(url); // The URL constructed for REST will always be Http(s) so, it is ok to cast here.
            //Hack - httpConnectorAddress calls httpURLConnection.setRequestProperty("Content-type", "application/octet-stream"); before returning connection above
View Full Code Here


         * Code in this method is copied from ServerRemoteAdminCommand to make it easier for sustaining to port back
         * these changes. In trunk, HttpConnectorAddress will be refactored such that all the code below will be
         * abstracted into HttpConnectorAddress.
         */
        private AuthenticationInfo authenticationInfo(Habitat habitat, SecureAdmin secureAdmin) {
            AuthenticationInfo result = null;
            if (SecureAdmin.Util.isUsingUsernamePasswordAuth(secureAdmin)) {
                final SecureAdminInternalUser secureAdminInternalUser = SecureAdmin.Util.secureAdminInternalUser(secureAdmin);
                if (secureAdminInternalUser != null) {
                    try {
                        String pw = habitat.getComponent(MasterPassword.class).getMasterPasswordAdapter().getPasswordForAlias(secureAdminInternalUser.getPasswordAlias());
                        result = new AuthenticationInfo(secureAdminInternalUser.getUsername(), pw);
                    } catch (Exception ex) {
                        throw new RuntimeException(ex);
                    }
                }
            }
View Full Code Here

                if (logger.isLoggable(Level.FINER)) {
                    logger.log(Level.FINER, "URI: {0}", uri.toString());
                    logger.log(Level.FINER, "Using auth info: User: {0}, Password: {1}",
                            new Object[]{user, ok(password) ? "<non-null>" : "<null>"});
                }
                final AuthenticationInfo authInfo = authenticationInfo();
                if (authInfo != null) {
                    HttpBasicAuthFilter besicAuth = new HttpBasicAuthFilter(authInfo.getUser(), authInfo.getPassword() == null ? "" : authInfo.getPassword());
                    target.register(besicAuth);
                }
                Metrix.event("doRestCommand() - about to prepare request builder");
                Builder request = target.request(acceptedResponseTypes);
                Metrix.event("doRestCommand() - about to add headers");
View Full Code Here

     * in building the outbound HTTP connection.
     *
     * @return the username/password auth. information to send with the request
     */
    protected AuthenticationInfo authenticationInfo() {
        return ((user != null || password != null) ? new AuthenticationInfo(user, password) : null);
    }
View Full Code Here

        }
    }

    @Override
    protected synchronized AuthenticationInfo authenticationInfo() {
        AuthenticationInfo result = null;
        if (SecureAdmin.Util.isUsingUsernamePasswordAuth(secureAdmin)) {
            final SecureAdminInternalUser secureAdminInternalUser = SecureAdmin.Util.secureAdminInternalUser(secureAdmin);
            if (secureAdminInternalUser != null) {
                try {
                    result = new AuthenticationInfo(secureAdminInternalUser.getUsername(),
                            new String(domainPasswordAliasStore.
                                get(secureAdminInternalUser.getPasswordAlias())));
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }
View Full Code Here

            /*
             * Any code that wants to trigger a retry will say so explicitly.
             */
            shouldTryCommandAgain = false;
            try {
                final AuthenticationInfo authInfo = authenticationInfo();
                if (logger.isLoggable(Level.FINER)) {
                    logger.log(Level.FINER, "URI: {0}", uriString);
                    logger.log(Level.FINER, "URL: {0}", url.toURL(uriString).toString());
                    logger.log(Level.FINER, "Method: {0}", httpMethod);
                    logger.log(Level.FINER, "Password options: {0}", passwordOptions);
View Full Code Here

     * in building the outbound HTTP connection.
     *
     * @return the username/password auth. information to send with the request
     */
    protected AuthenticationInfo authenticationInfo() {
        return ((user != null || password != null) ? new AuthenticationInfo(user, password) : null);
    }
View Full Code Here

        }
    }

    @Override
    protected synchronized AuthenticationInfo authenticationInfo() {
        AuthenticationInfo result = null;
        if (SecureAdmin.Util.isUsingUsernamePasswordAuth(secureAdmin)) {
            final SecureAdminInternalUser secureAdminInternalUser = SecureAdmin.Util.secureAdminInternalUser(secureAdmin);
            if (secureAdminInternalUser != null) {
                try {
                    result = new AuthenticationInfo(secureAdminInternalUser.getUsername(),
                            new String(domainPasswordAliasStore.
                                get(secureAdminInternalUser.getPasswordAlias())));
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }
View Full Code Here

        }
    }

    @Override
    protected synchronized AuthenticationInfo authenticationInfo() {
        AuthenticationInfo result = null;
        if (SecureAdmin.Util.isUsingUsernamePasswordAuth(secureAdmin)) {
            final SecureAdminInternalUser secureAdminInternalUser = SecureAdmin.Util.secureAdminInternalUser(secureAdmin);
            if (secureAdminInternalUser != null) {
                try {
                    result = new AuthenticationInfo(secureAdminInternalUser.getUsername(),
                            new String(domainPasswordAliasStore.
                                get(secureAdminInternalUser.getPasswordAlias())));
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }
View Full Code Here

            /*
             * Any code that wants to trigger a retry will say so explicitly.
             */
            shouldTryCommandAgain = false;
            try {
                final AuthenticationInfo authInfo = authenticationInfo();
                if (logger.isLoggable(Level.FINER)) {
                    logger.log(Level.FINER, "URI: {0}", uriString);
                    logger.log(Level.FINER, "URL: {0}", url.toURL(uriString).toString());
                    logger.log(Level.FINER, "Method: {0}", httpMethod);
                    logger.log(Level.FINER, "Password options: {0}", passwordOptions);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.admin.util.AuthenticationInfo

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.