Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.security.authentication.server
Class PseudoAuthenticationHandler

    java.lang.Object
      org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler

All Implemented Interfaces:
  AuthenticationHandler

    public class PseudoAuthenticationHandler

extends Object
implements AuthenticationHandler

The `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:

- simple.anonymous.allowed: `true|false`, default value is `false`

Field Summary
`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.

Constructor Summary
`PseudoAuthenticationHandler()`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TYPE

    public static final String TYPE

  Constant that identifies the authentication mechanism.

  See Also:
    Constant Field Values

### ANONYMOUS_ALLOWED

    public static final String ANONYMOUS_ALLOWED

  Constant for the configuration property that indicates if anonymous users are allowed.

  See Also:
    Constant Field Values

Constructor Detail

### PseudoAuthenticationHandler

    public PseudoAuthenticationHandler()

Method Detail

### init

    public void init(Properties config)
              throws javax.servlet.ServletException

  Initializes the authentication handler instance.

  This method is invoked by the `AuthenticationFilter.init(javax.servlet.FilterConfig)` method.

  Specified by:
    `init` in interface `AuthenticationHandler`
  Parameters:
    `config` - configuration properties to initialize the handler.
  Throws:
    `javax.servlet.ServletException` - thrown if the handler could not be initialized.

### getAcceptAnonymous

    protected boolean getAcceptAnonymous()

  Returns if the handler is configured to support anonymous users.

  Returns:
    if the handler is configured to support anonymous users.

### destroy

    public void destroy()

  Releases any resources initialized by the authentication handler.

  This implementation does a NOP.

  Specified by:
    `destroy` in interface `AuthenticationHandler`

### getType

    public String getType()

  Returns the authentication type of the authentication handler, 'simple'.

  Specified by:
    `getType` in interface `AuthenticationHandler`
  Returns:
    the authentication type of the authentication handler, 'simple'.

### authenticate

    public AuthenticationToken authenticate(javax.servlet.http.HttpServletRequest request,
                                            javax.servlet.http.HttpServletResponse response)
                                     throws IOException,
                                            AuthenticationException

  Authenticates an HTTP client request.

  It extracts the `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`.

  Specified by:
    `authenticate` in interface `AuthenticationHandler`
  Parameters:
    `request` - the HTTP client request.
    `response` - the HTTP client response.
  Returns:
    an authentication token if the HTTP client request is accepted and credentials are valid.
  Throws:
    `IOException` - thrown if an IO error occurred.
    `AuthenticationException` - thrown if HTTP client request was not accepted as an authentication request.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation