| java.lang.Object com.gargoylesoftware.htmlunit.DefaultCredentialsProvider
DefaultCredentialsProvider | public class DefaultCredentialsProvider implements CredentialsProvider,Serializable(Code) | | Default HtmlUnit implementation of the CredentialsProvider interface. Provides
credentials for both web servers and proxies. Supports NTLM authentication, Digest
authentication, and Basic HTTP authentication.
version: $Revision: 2132 $ author: Daniel Gredler author: Vikram Shitole author: Marc Guillemot author: Ahmed Ashour |
Method Summary | |
public void | addCredentials(String username, String password) Adds credentials for the specified username/password for any host/port/realm combination.
The credentials may be for any authentication scheme, including NTLM, digest and basic
HTTP authentication. | public 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. | public 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.
Parameters: username - The username for the new credentials. | public 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.
Parameters: username - The username for the new credentials. | public void | addProxyCredentials(String username, String password) Adds proxy credentials for the specified username/password for any host/port/realm combination. | public 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(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(AuthScheme scheme, String host, int port, boolean proxy) | protected void | clearAnswered() Clears the cache of answered (scheme, host, port, proxy) combinations. | public Credentials | getCredentials(AuthScheme scheme, String host, int port, boolean proxy) Returns the credentials associated with the specified scheme, host and port
Parameters: scheme - The authentication scheme being used (basic, digest, NTLM, etc). Parameters: host - The host we are authenticating for. Parameters: port - The port we are authenticating for. Parameters: proxy - Whether or not we are authenticating using a proxy. | final protected Log | getLog() | protected void | markAsAnswered(AuthScheme scheme, String host, int port, boolean proxy) | protected boolean | matchHost(AuthScope scope, String host) | protected boolean | matchPort(AuthScope scope, int port) | protected boolean | matchRealm(AuthScope scope, AuthScheme scheme) | protected boolean | matchScheme(AuthScope scope, AuthScheme scheme) |
DefaultCredentialsProvider | public DefaultCredentialsProvider()(Code) | | Creates a new DefaultCredentialsProvider instance.
|
addCredentials | public void addCredentials(String username, String password)(Code) | | Adds credentials for the specified username/password for any host/port/realm combination.
The credentials may be for any authentication scheme, including NTLM, digest and basic
HTTP authentication. If you are using sensitive username/password information, please do
NOT use this method. If you add credentials using this method, any server that requires
authentication will receive the specified username and password.
Parameters: username - The username for the new credentials. Parameters: password - The password for the new credentials. |
addCredentials | public void addCredentials(String username, String password, String host, int port, String realm)(Code) | | Adds credentials for the specified username/password on the specified host/port for the
specified realm. The credentials may be for any authentication scheme, including NTLM,
digest and basic HTTP authentication.
Parameters: username - The username for the new credentials. Parameters: password - The password for the new credentials. Parameters: host - The host to which to the new credentials apply (null if applicable to any host). Parameters: port - The port to which to the new credentials apply (negative if applicable to any port). Parameters: realm - The realm to which to the new credentials apply (null if applicable to any realm). |
addNTLMCredentials | public void addNTLMCredentials(String username, String password, String host, int port, String clientHost, String clientDomain)(Code) | | Adds NTLM credentials for the specified username/password on the specified host/port.
Parameters: 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. Parameters: password - The password for the new credentials. Parameters: host - The host to which to the new credentials apply (null if applicable to any host). Parameters: port - The port to which to the new credentials apply (negative if applicable to any port). Parameters: clientHost - The host the authentication request is originating from. Essentially, the computer name forthis machine. Parameters: clientDomain - The domain to authenticate within. |
addNTLMProxyCredentials | public void addNTLMProxyCredentials(String username, String password, String host, int port, String clientHost, String clientDomain)(Code) | | Adds NTLM proxy credentials for the specified username/password on the specified host/port.
Parameters: 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. Parameters: password - The password for the new credentials. Parameters: host - The host to which to the new credentials apply (null if applicable to any host). Parameters: port - The port to which to the new credentials apply (negative if applicable to any port). Parameters: clientHost - The host the authentication request is originating from. Essentially, the computer name forthis machine. Parameters: clientDomain - The domain to authenticate within. |
addProxyCredentials | public void addProxyCredentials(String username, String password)(Code) | | Adds proxy credentials for the specified username/password for any host/port/realm combination.
Parameters: username - The username for the new credentials. Parameters: password - The password for the new credentials. |
addProxyCredentials | public void addProxyCredentials(String username, String password, String host, int port)(Code) | | Adds proxy credentials for the specified username/password on the specified host/port.
Parameters: username - The username for the new credentials. Parameters: password - The password for the new credentials. Parameters: host - The host to which to the new credentials apply (null if applicable to any host). Parameters: port - The port to which to the new credentials apply (negative if applicable to any port). |
alreadyAnswered | protected boolean alreadyAnswered(AuthScheme scheme, String host, int port, boolean proxy)(Code) | | Indicates if this provider has already provided an answer for this (scheme, host, port, proxy).
Parameters: scheme - The scheme Parameters: host - the server name. Parameters: port - the server port. Parameters: proxy - is proxy true if the provider has already provided an answer for this. |
buildKey | protected Object buildKey(AuthScheme scheme, String host, int port, boolean proxy)(Code) | | Build a key with the specified data
Parameters: scheme - The scheme Parameters: host - the server name. Parameters: port - the server port. Parameters: proxy - is proxy the new key. |
clearAnswered | protected void clearAnswered()(Code) | | Clears the cache of answered (scheme, host, port, proxy) combinations.
|
getCredentials | public Credentials getCredentials(AuthScheme scheme, String host, int port, boolean proxy) throws CredentialsNotAvailableException(Code) | | Returns the credentials associated with the specified scheme, host and port
Parameters: scheme - The authentication scheme being used (basic, digest, NTLM, etc). Parameters: host - The host we are authenticating for. Parameters: port - The port we are authenticating for. Parameters: proxy - Whether or not we are authenticating using a proxy. The credentials corresponding to the specified scheme, host and port or null if already asked for it to avoid infinite loop throws: CredentialsNotAvailableException - If the specified credentials cannot be provided due to an error. See Also: CredentialsProvider.getCredentials(AuthSchemeStringintboolean) |
getLog | final protected Log getLog()(Code) | | Return the log object for this class
The log object |
markAsAnswered | protected void markAsAnswered(AuthScheme scheme, String host, int port, boolean proxy)(Code) | | Parameters: scheme - The scheme Parameters: host - the server name. Parameters: port - the server port. Parameters: proxy - is proxy |
matchHost | protected boolean matchHost(AuthScope scope, String host)(Code) | | Parameters: host - the request host for which Credentials are asked Parameters: scope - the configured authorization scope true if the scope's host matches the provided one |
matchPort | protected boolean matchPort(AuthScope scope, int port)(Code) | | Parameters: port - the request port for which Credentials are asked Parameters: scope - the configured authorization scope true if the scope's port matches the provided one |
matchRealm | protected boolean matchRealm(AuthScope scope, AuthScheme scheme)(Code) | | Parameters: scheme - the request scheme for which Credentials are asked Parameters: scope - the configured authorization scope true if the scope's realm matches the one of the scheme |
matchScheme | protected boolean matchScheme(AuthScope scope, AuthScheme scheme)(Code) | | Parameters: scheme - the request scheme for which Credentials are asked Parameters: scope - the configured authorization scope true if the scope's scheme matches the provided one |
|
|