/** * Creates a password user credential object given a username and password. * * @param userName the name of a user to authenticate * @param password the user's password * @param storageAllowed if <span class="javakeyword">true</span> then * this credential is allowed to be stored in the * global auth cache, otherwise not * @param url url these credentials are applied to * @param isPartial whether this object only contains part of credentials information * * @since 1.8.9 */ public static SVNPasswordAuthentication newInstance(String userName, char[] password, boolean storageAllowed, SVNURL url, boolean isPartial) { return new SVNPasswordAuthentication(userName, password, storageAllowed, url, isPartial); }
protected HTTPAuthentication (SVNPasswordAuthentication credentials) { if (credentials != null) { myUserName = credentials.getUserName(); myPassword = credentials.getPassword(); } }
/** * Creates an auth manager given a user credential - a username * and password. * * @deprecated Use {@link #newInstance(String, char[])} method * * @param userName a username * @param password a password */ public BasicAuthenticationManager(String userName, String password) { this(new SVNAuthentication[] { SVNPasswordAuthentication.newInstance(userName, password != null ? password.toCharArray() : null, false, null, false), SVNSSHAuthentication.newInstance(userName, password != null ? password.toCharArray() : null, -1, false, null, false), SVNUserNameAuthentication.newInstance(userName, false, null, false), }); }
protected HTTPAuthentication (SVNPasswordAuthentication credentials) { if (credentials != null) { myUserName = credentials.getUserName(); myPassword = credentials.getPasswordValue(); } }
@Override public SVNAuthentication copy() { return new SVNPasswordAuthentication(getUserName(), copyOf(myPassword), isStorageAllowed(), getURL(), isPartial()); } }
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { Callback callback = callbacks[i]; if (callback instanceof NameCallback) { String userName = myAuthentication.getUserName(); ((NameCallback) callback).setName(userName != null ? userName : ""); } else if (callback instanceof PasswordCallback) { String password = ((SVNPasswordAuthentication) myAuthentication).getPassword(); ((PasswordCallback) callback).setPassword(password != null ? password.toCharArray() : new char[0]); } else if (callback instanceof RealmCallback) { ((RealmCallback) callback).setText(myRealm); } else { throw new UnsupportedCallbackException(callback); } } } }
SVNPasswordAuthentication auth = readSSLPassphrase(realm, props, url); if (auth != null) { matchedAuths.put(auth.getUserName(), auth); return SVNPasswordAuthentication.newInstance("", matchedAuth.getPasswordValue(), storageAllowed, url, false);
if (passphrase != null && passphrase.getPasswordValue() != null) { sslAuth = SVNSSLAuthentication.newInstance(clientCertFile, passphrase.getPasswordValue(), authMayBeStored, url, false); return SVNPasswordAuthentication.newInstance(userName, password, authMayBeStored, url, password == null); if (passphrase == null || "".equals(passphrase)) { SVNPasswordAuthentication passphraseAuth = readSSLPassphrase(kind, path, authMayBeStored, url); if (passphraseAuth != null && passphraseAuth.getPasswordValue() != null) { sslAuth = SVNSSLAuthentication.newInstance(new File(path), passphraseAuth.getPasswordValue(), authMayBeStored, url, false);
if (defaultUserName != null) { SVNPasswordAuthentication partialAuth = SVNPasswordAuthentication.newInstance(defaultUserName, null, false, url, true); return partialAuth; return SVNPasswordAuthentication.newInstance(myUserName, null, false, url, true); return SVNPasswordAuthentication.newInstance(myUserName, myPassword, myIsStore, url, false).copy(); } else if (ISVNAuthenticationManager.USERNAME.equals(kind)) { if (myUserName == null || "".equals(myUserName)) {
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { Callback callback = callbacks[i]; if (callback instanceof NameCallback) { String userName = myAuthentication.getUserName(); ((NameCallback) callback).setName(userName != null ? userName : ""); } else if (callback instanceof PasswordCallback) { String password = ((SVNPasswordAuthentication) myAuthentication).getPassword(); ((PasswordCallback) callback).setPassword(password != null ? password.toCharArray() : new char[0]); } else if (callback instanceof RealmCallback) { ((RealmCallback) callback).setText(myRealm); } else { throw new UnsupportedCallbackException(callback); } } } }
public void setCredentials(SVNPasswordAuthentication credentials) { if (credentials != null) { myUserName = credentials.getUserName(); myPassword = credentials.getPasswordValue(); } }
} else { BasicAuthenticationManager.acknowledgeAuthentication(true, ISVNAuthenticationManager.SSL, clientCertPath, null, SVNPasswordAuthentication.newInstance("", clientCertPassword, sslAuthentication.isStorageAllowed(), sslAuthentication.getURL(), false), url, authenticationManager); passphrase = ((SVNPasswordAuthentication) auth).getPasswordValue(); } else { auth = null;
public List<SVNAuthentication> build(String kind, SVNURL url) { if (ISVNAuthenticationManager.PASSWORD.equals(kind)) { return Collections.<SVNAuthentication>singletonList( new SVNPasswordAuthentication(username, Scrambler.descramble(password), false, url, false)); } if (ISVNAuthenticationManager.SSH.equals(kind)) { return Collections.<SVNAuthentication>singletonList( new SVNSSHAuthentication(username, Scrambler.descramble(password), -1, false, url, false)); } return Collections.emptyList(); } }
public void setCredentials(SVNPasswordAuthentication credentials) { if (credentials != null) { myUserName = credentials.getUserName(); myPassword = credentials.getPassword(); } }
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { Callback callback = callbacks[i]; if (callback instanceof NameCallback) { String userName = myAuthentication.getUserName(); ((NameCallback) callback).setName(userName != null ? userName : ""); } else if (callback instanceof PasswordCallback) { String password = ((SVNPasswordAuthentication) myAuthentication).getPassword(); ((PasswordCallback) callback).setPassword(password != null ? password.toCharArray() : new char[0]); } else if (callback instanceof RealmCallback) { ((RealmCallback) callback).setText(myRealm); } else { throw new UnsupportedCallbackException(callback); } } } }
public byte[] buildChallengeResponse(byte[] challenge) throws IOException { byte[] password = SVNEncodingUtil.getBytes(myCredentials.getPasswordValue(), "UTF-8"); byte[] secret = new byte[64]; Arrays.fill(secret, (byte) 0); hexDigest += SVNFormatUtil.getHexNumberFromByte(result[i]); String response = myCredentials.getUserName() + " " + hexDigest; response = response.getBytes("UTF-8").length + ":" + response + " "; return response.getBytes("UTF-8");
/** * Creates an auth manager given a user credential - a username * and password. * * @param userName a username * @param password a password * * @since 1.8.9 */ public static BasicAuthenticationManager newInstance(String userName, char[] password) { return newInstance(new SVNAuthentication[] { SVNPasswordAuthentication.newInstance(userName, password, false, null, false), SVNSSHAuthentication.newInstance(userName, password, -1, false, null, false), SVNUserNameAuthentication.newInstance(userName, false, null, false), }); }
@Override public SVNAuthentication createSVNAuthentication(String kind) { if (kind.equals(ISVNAuthenticationManager.SSH)) { return new SVNSSHAuthentication(userName, Scrambler.descramble(password), -1, false); } else { return new SVNPasswordAuthentication(userName, Scrambler.descramble(password), false); } }
protected HTTPAuthentication (SVNPasswordAuthentication credentials) { if (credentials != null) { myUserName = credentials.getUserName(); myPassword = credentials.getPassword(); } }
private void savePasswordCredential(Map values, SVNAuthentication auth, String realm) throws SVNException { values.put("username", auth.getUserName()); boolean storePasswords = isStorePasswords(auth.getURL()); boolean maySavePassword = false; SVNPasswordCipher cipher = null; if (storePasswords) { String cipherType = SVNPasswordCipher.getDefaultCipherType(); cipher = SVNPasswordCipher.getInstance(cipherType); if (cipherType != null) { if (!SVNPasswordCipher.SIMPLE_CIPHER_TYPE.equals(cipherType)) { maySavePassword = true; } else { maySavePassword = isStorePlainTextPasswords(realm, auth); } if (maySavePassword) { values.put("passtype", cipherType); } } } if (maySavePassword) { SVNPasswordAuthentication passwordAuth = (SVNPasswordAuthentication) auth; values.put("password", cipher.encrypt(passwordAuth.getPassword())); } }