public class BasicAuthScheme extends java.lang.Object implements AuthScheme
Modifier and Type | Field and Description |
---|---|
static BasicAuthScheme |
INSTANCE
Sole instance.
|
Modifier and Type | Method and Description |
---|---|
ContextFactory |
createContextFactory(Challenge challenge,
java.net.URL url)
Attempts to return an object that can take user input to generate
an AuthContext based on a given challenge.
|
static java.lang.String |
encodeUserPass(java.lang.String user,
char[] pass)
Encodes the user:password pair as a Base64-encoded string,
as described by RFC 7617.
|
java.lang.String |
getName()
Returns a human-readable name identifying the authentication
scheme implemented by this object.
|
public static final BasicAuthScheme INSTANCE
public java.lang.String getName()
AuthScheme
auth-scheme
token from an RFC7235 challenge (for instance "Basic" for Basic
authentication), but a different value may be used if required
to distinguish it from other instances.getName
in interface AuthScheme
public ContextFactory createContextFactory(Challenge challenge, java.net.URL url) throws BadChallengeException
AuthScheme
Note that this method should just examine the syntax of the supplied challenge; it is not expected to make network connections etc to determine if context creation will be successful.
createContextFactory
in interface AuthScheme
challenge
- authentication challenge objecturl
- URL with which the challenge is associatedBadChallengeException
- if the challenge scheme etc
indicates that it is destined for this AuthScheme,
but the challenge is not of the correct formpublic static java.lang.String encodeUserPass(java.lang.String user, char[] pass)
user
- user namepass
- password