public abstract class AuthScheme
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AUTHENTICATE_RESPONSE_HEADER
The authenticate response header name ('WWW-Authenticate').
|
java.lang.String |
authenticateResponseHeader |
static java.lang.String |
DEFAULT_UNAUTHORIZED_MESSAGE
The default message sent when unauthorized ('Authorization Required').
|
java.lang.String |
realm |
java.lang.String |
scheme |
| Modifier and Type | Method and Description |
|---|---|
abstract Request |
addAuth(Request request,
java.lang.String userId,
java.lang.String secret)
Adds authentication credentials to a request.
|
abstract Response |
authenticate(Request request,
java.lang.String userId,
java.lang.String secret)
Authenticates the request.
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getAuthenticateResponseHeader()
Gets the value for the
WWW-Authenticate header. |
java.lang.String |
getRealm()
Gets the realm.
|
java.lang.String |
getScheme()
Gets the scheme.
|
Response |
getUnauthorizedResponse(java.lang.String message)
Creates a challenge response.
|
abstract java.lang.String |
getUserId(Request request)
Gets the user id from the request, if possible.
|
abstract boolean |
hasCredentials(Request request)
Determines if the request has any (invalid or valid) credentials for this scheme.
|
int |
hashCode() |
public static final java.lang.String DEFAULT_UNAUTHORIZED_MESSAGE
public static final java.lang.String AUTHENTICATE_RESPONSE_HEADER
public final java.lang.String scheme
public final java.lang.String realm
public final java.lang.String authenticateResponseHeader
public abstract boolean hasCredentials(Request request)
request - The request.public abstract Request addAuth(Request request, java.lang.String userId, java.lang.String secret) throws java.security.GeneralSecurityException
request - The request to which credentials are added.userId - An id that uniquely identifies the user (e.g. 'username').secret - The authentication secret for the username.java.security.GeneralSecurityExceptionpublic abstract java.lang.String getUserId(Request request) throws java.security.GeneralSecurityException
request - The request.null if none.java.security.GeneralSecurityExceptionpublic abstract Response authenticate(Request request, java.lang.String userId, java.lang.String secret) throws java.security.GeneralSecurityException
request - The request.userId - The user id for the secret.secret - The secret data.null.java.security.GeneralSecurityExceptionpublic Response getUnauthorizedResponse(java.lang.String message)
By default, returns the standard HTTP challenge response.
message - A message returned with the response. If null, a standard message is returned.public java.lang.String getScheme()
public java.lang.String getRealm()
public java.lang.String getAuthenticateResponseHeader()
WWW-Authenticate header.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Object