Package org.apache.ivy.util

Examples of org.apache.ivy.util.Credentials


            return true;
        }

        public String getPassword() {
            if (userPassword == null) {
                Credentials c = CredentialsUtil.promptCredentials(new Credentials(null, host,
                        userName, userPassword), passfile);
                if (c != null) {
                    userName = c.getUserName();
                    userPassword = c.getPasswd();
                }
            }
            return userPassword;
        }
View Full Code Here


            return userPassword;
        }

        public String getPassphrase() {
            if (pemPassword == null && pemFile != null) {
                Credentials c = CredentialsUtil.promptCredentials(
                    new Credentials(null, pemFile.getAbsolutePath(), userName, pemPassword),
                    passfile);
                if (c != null) {
                    userName = c.getUserName();
                    pemPassword = c.getPasswd();
                }
            }
            return pemPassword;
        }
View Full Code Here

            throw new IllegalArgumentException(
                    "missing host information. host should be provided either "
                            + "directly on the repository or in the connection URI");
        }
        if (user == null) {
            Credentials c = requestCredentials(host);
            if (c != null) {
                user = c.getUserName();
                userPassword = c.getPasswd();
            } else {
                Message.error("username is not set");
            }
        }
        return SshCache.getInstance().getSession(host, port, user, userPassword, getKeyFile(),
View Full Code Here

     * @return credentials for given host
     **/
    private Credentials requestCredentials(String host) {
        Object o = credentialsCache.get(host);
        if (o == null) {
            Credentials c = CredentialsUtil.promptCredentials(new Credentials(null, host, user,
                    userPassword), getPassFile());
            if (c != null) {
                if (credentialsCache.size() > MAX_CREDENTILAS_CACHE_SIZE) {
                    credentialsCache.clear();
                }
View Full Code Here

                String proxyPass = System.getProperty("http.proxyPassword", "");
                Message.debug("authenicating to proxy server with username [" + proxyUser + "]");
                result = new PasswordAuthentication(proxyUser, proxyPass.toCharArray());
            }
        } else {
            Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(),
                getRequestingHost());
            Message.debug("authentication: k='"
                    + Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='"
                    + c + "'");
            if (c != null) {
                final String password = c.getPasswd() == null ? "" : c.getPasswd();
                result = new PasswordAuthentication(c.getUserName(), password.toCharArray());
            }
        }

        if ((result == null) && (original != null)) {
            Authenticator.setDefault(original);
View Full Code Here

    public void addCredentials(String realm, String host, String userName, String passwd) {
        if (userName == null) {
            return;
        }
        Credentials c = new Credentials(realm, host, userName, passwd);
        Message.debug("credentials added: " + c);
        KEYRING.put(c.getKey(), c);
        SECURED_HOSTS.add(host);
    }
View Full Code Here

            return true;
        }

        public String getPassword() {
            if (userPassword == null) {
                Credentials c = CredentialsUtil.promptCredentials(new Credentials(null, host,
                        userName, userPassword), passfile);
                if (c != null) {
                    userName = c.getUserName();
                    userPassword = c.getPasswd();
                }
            }
            return userPassword;
        }
View Full Code Here

            return userPassword;
        }

        public String getPassphrase() {
            if (pemPassword == null && pemFile != null) {
                Credentials c = CredentialsUtil.promptCredentials(new Credentials(null, pemFile
                        .getAbsolutePath(), userName, pemPassword), passfile);
                if (c != null) {
                    userName = c.getUserName();
                    pemPassword = c.getPasswd();
                }
            }
            return pemPassword;
        }
View Full Code Here

                    userPassword = userInfo.substring(userInfo.indexOf(":") + 1);
                }
            }
        }
        if (user == null) {
             Credentials c = requestCredentials(host);
             if (c != null) {
                 user = c.getUserName();
                 userPassword = c.getPasswd();
             } else {
                 Message.error("username is not set");
             }
        }
        return SshCache.getInstance().getSession(host, port, user, userPassword, getKeyFile(),
View Full Code Here

     * @return credentials for given host
     **/
    private Credentials requestCredentials(String host) {
      Object o =  credentialsCache.get(host);
      if (o == null) {
         Credentials c = CredentialsUtil.promptCredentials(
             new Credentials(null, host, user, userPassword), getPassFile());
         if (c != null) {
            if (credentialsCache.size() > MAX_CREDENTILAS_CACHE_SIZE) {
              credentialsCache.clear();
            }
            credentialsCache.put(host, c);
View Full Code Here

TOP

Related Classes of org.apache.ivy.util.Credentials

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.