Class HttpBasicAuth
- java.lang.Object
-
- org.opendaylight.aaa.tokenauthrealm.auth.HttpBasicAuth
-
- All Implemented Interfaces:
TokenAuth
public class HttpBasicAuth extends Object implements TokenAuth
An HTTP Basic authenticator. Note that this is provided as a Hydrogen backward compatible authenticator, but usage of this authenticator or HTTP Basic Authentication is highly discouraged due to its vulnerability.To obtain a token using the HttpBasicAuth Strategy, add a header to your HTTP request in the form:
Authorization: Basic BASE_64_ENCODED_CREDENTIALS
Where
BASE_64_ENCODED_CREDENTIALS
is the base 64 encoded value of the user's credentials in the following form:user:password
For example, assuming the user is "admin" and the password is "admin":
Authorization: Basic YWRtaW46YWRtaW4=
- Author:
- liemmn
-
-
Field Summary
Fields Modifier and Type Field Description static String
AUTH_HEADER
static String
AUTH_SEP
static String
BASIC_PREFIX
static String
DEFAULT_DOMAIN
-
Constructor Summary
Constructors Constructor Description HttpBasicAuth(CredentialAuth<PasswordCredentials> credentialAuth)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Authentication
validate(Map<String,List<String>> headers)
Validate the given token contained in the in-bound headers.
-
-
-
Field Detail
-
AUTH_HEADER
public static final String AUTH_HEADER
- See Also:
- Constant Field Values
-
AUTH_SEP
public static final String AUTH_SEP
- See Also:
- Constant Field Values
-
BASIC_PREFIX
public static final String BASIC_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_DOMAIN
public static final String DEFAULT_DOMAIN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HttpBasicAuth
public HttpBasicAuth(CredentialAuth<PasswordCredentials> credentialAuth)
-
-
Method Detail
-
validate
public Authentication validate(Map<String,List<String>> headers) throws AuthenticationException
Description copied from interface:TokenAuth
Validate the given token contained in the in-bound headers.If there is no token signature in the given headers for this implementation, this method should return a null. If there is an applicable token signature, but the token validation fails, this method should throw an
AuthenticationException
.- Specified by:
validate
in interfaceTokenAuth
- Parameters:
headers
- headers containing token to validate- Returns:
- authenticated context, or null if not applicable
- Throws:
AuthenticationException
- if authentication fails
-
-