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)
Indicates if this provider has already provided an answer for this (scheme, host, port, proxy).
|
protected Object |
buildKey(org.apache.commons.httpclient.auth.AuthScheme scheme,
String host,
int port,
boolean proxy)
Build 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 org.apache.commons.logging.Log |
getLog()
Return the log object for this class
|
protected void |
markAsAnswered(org.apache.commons.httpclient.auth.AuthScheme scheme,
String host,
int port,
boolean proxy) |
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 credentials.password
- The password for the new credentials.public void addCredentials(String username, String password, String host, int port, String realm)
username
- The username for the new credentials.password
- The password for the new credentials.host
- 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 credentials.password
- The password for the new credentials.public void addProxyCredentials(String username, String password, String host, int port)
username
- The username for the new credentials.password
- The password for the new credentials.host
- 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. This should not include the domain to authenticate with.
For example: "user" is correct whereas "DOMAIN\\user" is not.password
- The password for the new credentials.host
- 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 within.public void addNTLMProxyCredentials(String username, String password, String host, int port, String clientHost, String clientDomain)
username
- The username for the new credentials. This should not include the domain to authenticate with.
For example: "user" is correct whereas "DOMAIN\\user" is not.password
- The password for the new credentials.host
- 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 within.public 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.CredentialsProvider
scheme
- The authentication scheme being used (basic, digest, NTLM, etc).host
- The host we are authenticating for.port
- The port we are authenticating for.proxy
- Whether or not we are authenticating using a proxy.null
if already asked for it to avoid infinite looporg.apache.commons.httpclient.auth.CredentialsNotAvailableException
- If the specified credentials cannot be provided due to an error.CredentialsProvider.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 name.port
- the server port.proxy
- is proxyprotected void markAsAnswered(org.apache.commons.httpclient.auth.AuthScheme scheme, String host, int port, boolean proxy)
scheme
- The schemehost
- the server name.port
- the server port.proxy
- is proxyprotected void clearAnswered()
protected Object buildKey(org.apache.commons.httpclient.auth.AuthScheme scheme, String host, int port, boolean proxy)
scheme
- The schemehost
- the server name.port
- the server port.proxy
- is proxyprotected final org.apache.commons.logging.Log getLog()
Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.