public class PseudoAuthenticationHandler extends Object implements AuthenticationHandler
PseudoAuthenticationHandler
provides a pseudo authentication mechanism that accepts
the user name specified as a query string parameter.
This mimics the model of Hadoop Simple authentication which trust the 'user.name' property provided in
the configuration object.
This handler can be configured to support anonymous users.
The only supported configuration property is:
true|false
, default value is false
限定符和类型 | 字段和说明 |
---|---|
static String |
ANONYMOUS_ALLOWED
Constant for the configuration property that indicates if anonymous users are allowed.
|
static String |
TYPE
Constant that identifies the authentication mechanism.
|
构造器和说明 |
---|
PseudoAuthenticationHandler() |
限定符和类型 | 方法和说明 |
---|---|
AuthenticationToken |
authenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Authenticates an HTTP client request.
|
void |
destroy()
Releases any resources initialized by the authentication handler.
|
protected boolean |
getAcceptAnonymous()
Returns if the handler is configured to support anonymous users.
|
String |
getType()
Returns the authentication type of the authentication handler, 'simple'.
|
void |
init(Properties config)
Initializes the authentication handler instance.
|
public static final String TYPE
public void init(Properties config) throws javax.servlet.ServletException
AuthenticationFilter.init(javax.servlet.FilterConfig)
method.init
在接口中 AuthenticationHandler
config
- configuration properties to initialize the handler.javax.servlet.ServletException
- thrown if the handler could not be initialized.protected boolean getAcceptAnonymous()
public void destroy()
destroy
在接口中 AuthenticationHandler
public String getType()
getType
在接口中 AuthenticationHandler
public AuthenticationToken authenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, AuthenticationException
PseudoAuthenticator.USER_NAME
parameter from the query string and creates
an AuthenticationToken
with it.
If the HTTP client request does not contain the PseudoAuthenticator.USER_NAME
parameter and
the handler is configured to allow anonymous users it returns the AuthenticationToken.ANONYMOUS
token.
If the HTTP client request does not contain the PseudoAuthenticator.USER_NAME
parameter and
the handler is configured to disallow anonymous users it throws an AuthenticationException
.authenticate
在接口中 AuthenticationHandler
request
- the HTTP client request.response
- the HTTP client response.IOException
- thrown if an IO error occurred.AuthenticationException
- thrown if HTTP client request was not accepted as an authentication request.Copyright © 2009 The Apache Software Foundation