Methods Summary |
---|
public synchronized void | clear()Clears all credentials.
this.credMap.clear();
|
public synchronized org.apache.http.auth.Credentials | getCredentials(org.apache.http.auth.AuthScope authscope)Get the {@link Credentials credentials} for the given authentication scope.
if (authscope == null) {
throw new IllegalArgumentException("Authentication scope may not be null");
}
return matchCredentials(this.credMap, authscope);
|
private static org.apache.http.auth.Credentials | matchCredentials(java.util.HashMap map, org.apache.http.auth.AuthScope authscope)Find matching {@link Credentials credentials} for the given authentication scope.
// see if we get a direct hit
Credentials creds = map.get(authscope);
if (creds == null) {
// Nope.
// Do a full scan
int bestMatchFactor = -1;
AuthScope bestMatch = null;
for (AuthScope current: map.keySet()) {
int factor = authscope.match(current);
if (factor > bestMatchFactor) {
bestMatchFactor = factor;
bestMatch = current;
}
}
if (bestMatch != null) {
creds = map.get(bestMatch);
}
}
return creds;
|
public synchronized void | setCredentials(org.apache.http.auth.AuthScope authscope, org.apache.http.auth.Credentials credentials)Sets the {@link Credentials credentials} for the given authentication
scope. Any previous credentials for the given scope will be overwritten.
if (authscope == null) {
throw new IllegalArgumentException("Authentication scope may not be null");
}
credMap.put(authscope, credentials);
|
public java.lang.String | toString()
return credMap.toString();
|