public class ChallengeAuthentication extends java.lang.Object implements AuthenticationScheme
URLConnection.
The Default variant is BASIC Authentication as configured in metadata. The variant is decided when the ChallengeAuthentication is instantiated. ChallengeAuthentication(String realm, boolean useDigest). A value of true for the useDigest param will enable Digest authentication.
AuthenticationScheme| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PASSWORD |
static java.lang.String |
USERNAME |
ATTR_PROVIDER, AUTHENTICATION| Constructor and Description |
|---|
ChallengeAuthentication(Node description)
Instantiate this ChallengeAuthentication Scheme from the persisted metadata.
|
ChallengeAuthentication(java.lang.String realm, boolean useDigest)
Set the authorization information on this connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
authenticate(HTTPClient.HTTPConnection conn)
Authenticate the HTTPConnection instance using this authentication scheme.
|
void |
authenticate(java.lang.String host, int port)
Enforce challange authentication for a particular host/port
|
Node |
describe()
Describe this Authentication scheme.
|
java.util.Map |
getCredentials()
Deprecated.
Use
getCredentialsWithCharArrayPassword() method instead. |
java.util.Map |
getCredentialsWithCharArrayPassword()
Fetch the credentials represented by the scheme.
|
java.lang.String |
getRealm()
Gets the realm
|
boolean |
isDigest() |
void |
loadCredentials(java.util.Map environment)
Load the Authentication Scheme with credentials from Credential store.
|
public static final java.lang.String USERNAME
public static final java.lang.String PASSWORD
public ChallengeAuthentication(java.lang.String realm,
boolean useDigest)
relam - The authorization realm .digestAuth - Indicates the mode of authorization. if true indicates that DIGEST authentication should be done. if false BASIC authentication is done.public ChallengeAuthentication(Node description) throws ConnectionException
description - Node describing this Challange Authentication scheme.{@link - ConnectionException} if there was an error in reading the description provided to initiaize the authentication scheme.ConnectionExceptionpublic void loadCredentials(java.util.Map environment)
Map represents the environment that has the security configuration passed by the Connection Manager which contains the credential properties that this scheme defines.loadCredentials in interface AuthenticationSchemeenvironment - The environment that has the credential properties defined by this scheme.public java.util.Map getCredentials()
getCredentialsWithCharArrayPassword() method instead.getCredentials in interface AuthenticationSchemeMap representing the connection credentialspublic java.util.Map getCredentialsWithCharArrayPassword()
getCredentialsWithCharArrayPassword in interface AuthenticationSchemeMap representing the connection credentials. The password will be char array.public java.lang.String getRealm()
public boolean isDigest()
public Node describe()
describe in interface AuthenticationSchemeNode describing this authentication scheme.
public void authenticate(HTTPClient.HTTPConnection conn)
throws ConnectionException
authenticate in interface AuthenticationSchemeconn - The HTTPConnection instance that represents the interaction for the URLConnection{@link - ConnectionException} If the authentication fails.ConnectionException
public void authenticate(java.lang.String host,
int port)
throws ConnectionException
authenticate in interface AuthenticationSchemehost - The Host for which the authentication is to be doneport - The related port for which authentication is to be done{@link - ConnectionException} if there was failure or error when authenticating.ConnectionException