public class DefaultCredentialsProvider extends Object implements org.apache.commons.httpclient.auth.CredentialsProvider, Serializable
| Constructor and Description |
|---|
DefaultCredentialsProvider()
Creates a new DefaultCredentialsProvider instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCredentials(String username,
String password)
Adds credentials for the specified username/password for any host/port/realm combination.
|
void |
addCredentials(String username,
String password,
String host,
int port,
String realm)
Adds credentials for the specified username/password on the specified host/port for the
specified realm.
|
void |
addNTLMCredentials(String username,
String password,
String host,
int port,
String clientHost,
String clientDomain)
Adds NTLM credentials for the specified username/password on the specified host/port.
|
void |
addNTLMProxyCredentials(String username,
String password,
String host,
int port,
String clientHost,
String clientDomain)
Adds NTLM proxy credentials for the specified username/password on the specified host/port.
|
void |
addProxyCredentials(String username,
String password)
Adds proxy credentials for the specified username/password for any host/port/realm combination.
|
void |
addProxyCredentials(String username,
String password,
String host,
int port)
Adds proxy credentials for the specified username/password on the specified host/port.
|
protected boolean |
alreadyAnswered(org.apache.commons.httpclient.auth.AuthScheme scheme,
String host,
int port,
boolean proxy)
Returns true if this provider has already provided an answer for the
specified (scheme, host, port, proxy) combination.
|
protected Object |
buildKey(org.apache.commons.httpclient.auth.AuthScheme scheme,
String host,
int port,
boolean proxy)
Builds a key with the specified data.
|
protected void |
clearAnswered()
Clears the cache of answered (scheme, host, port, proxy) combinations.
|
org.apache.commons.httpclient.Credentials |
getCredentials(org.apache.commons.httpclient.auth.AuthScheme scheme,
String host,
int port,
boolean proxy)
Returns the credentials associated with the specified scheme, host and port.
|
protected void |
markAsAnswered(org.apache.commons.httpclient.auth.AuthScheme scheme,
String host,
int port,
boolean proxy)
Marks the specified (scheme, host, port, proxy) combination as having already been processed.
|
protected boolean |
matchHost(org.apache.commons.httpclient.auth.AuthScope scope,
String host) |
protected boolean |
matchPort(org.apache.commons.httpclient.auth.AuthScope scope,
int port) |
protected boolean |
matchRealm(org.apache.commons.httpclient.auth.AuthScope scope,
org.apache.commons.httpclient.auth.AuthScheme scheme) |
protected boolean |
matchScheme(org.apache.commons.httpclient.auth.AuthScope scope,
org.apache.commons.httpclient.auth.AuthScheme scheme) |
public DefaultCredentialsProvider()
public void addCredentials(String username, String password)
username - the username for the new credentialspassword - the password for the new credentialspublic void addCredentials(String username, String password, String host, int port, String realm)
username - the username for the new credentialspassword - the password for the new credentialshost - the host to which to the new credentials apply (null if applicable to any host)port - the port to which to the new credentials apply (negative if applicable to any port)realm - the realm to which to the new credentials apply (null if applicable to any realm)public void addProxyCredentials(String username, String password)
username - the username for the new credentialspassword - the password for the new credentialspublic void addProxyCredentials(String username, String password, String host, int port)
username - the username for the new credentialspassword - the password for the new credentialshost - the host to which to the new credentials apply (null if applicable to any host)port - the port to which to the new credentials apply (negative if applicable to any port)public void addNTLMCredentials(String username, String password, String host, int port, String clientHost, String clientDomain)
username - the username for the new credentials; should not include the domain to authenticate with;
for example: "user" is correct whereas "DOMAIN\\user" is notpassword - the password for the new credentialshost - the host to which to the new credentials apply (null if applicable to any host)port - the port to which to the new credentials apply (negative if applicable to any port)clientHost - the host the authentication request is originating from; essentially, the computer name for
this machine.clientDomain - the domain to authenticate withinpublic void addNTLMProxyCredentials(String username, String password, String host, int port, String clientHost, String clientDomain)
username - the username for the new credentials; should not include the domain to authenticate with;
for example: "user" is correct whereas "DOMAIN\\user" is not.password - the password for the new credentialshost - the host to which to the new credentials apply (null if applicable to any host)port - the port to which to the new credentials apply (negative if applicable to any port)clientHost - the host the authentication request is originating from; essentially, the computer name for
this machineclientDomain - the domain to authenticate withinpublic org.apache.commons.httpclient.Credentials getCredentials(org.apache.commons.httpclient.auth.AuthScheme scheme,
String host,
int port,
boolean proxy)
throws org.apache.commons.httpclient.auth.CredentialsNotAvailableException
getCredentials in interface org.apache.commons.httpclient.auth.CredentialsProviderscheme - the authentication scheme being used (basic, digest, NTLM, etc)host - the host we are authenticating forport - the port we are authenticating forproxy - Whether or not we are authenticating using a proxynull
if already asked for it to avoid infinite looporg.apache.commons.httpclient.auth.CredentialsNotAvailableException - if the specified credentials cannot be provided due to an errorCredentialsProvider.getCredentials(AuthScheme, String, int, boolean)protected boolean matchRealm(org.apache.commons.httpclient.auth.AuthScope scope,
org.apache.commons.httpclient.auth.AuthScheme scheme)
scheme - the request scheme for which Credentials are askedscope - the configured authorization scopetrue if the scope's realm matches the one of the schemeprotected boolean matchPort(org.apache.commons.httpclient.auth.AuthScope scope,
int port)
port - the request port for which Credentials are askedscope - the configured authorization scopetrue if the scope's port matches the provided oneprotected boolean matchHost(org.apache.commons.httpclient.auth.AuthScope scope,
String host)
host - the request host for which Credentials are askedscope - the configured authorization scopetrue if the scope's host matches the provided oneprotected boolean matchScheme(org.apache.commons.httpclient.auth.AuthScope scope,
org.apache.commons.httpclient.auth.AuthScheme scheme)
scheme - the request scheme for which Credentials are askedscope - the configured authorization scopetrue if the scope's scheme matches the provided oneprotected boolean alreadyAnswered(org.apache.commons.httpclient.auth.AuthScheme scheme,
String host,
int port,
boolean proxy)
scheme - the schemehost - the server nameport - the server portproxy - is proxyprotected void markAsAnswered(org.apache.commons.httpclient.auth.AuthScheme scheme,
String host,
int port,
boolean proxy)
scheme - the schemehost - the server nameport - the server portproxy - is proxyprotected void clearAnswered()
Copyright © 2002–2014 Gargoyle Software Inc.. All rights reserved.