org.apache.sling.auth.core.spi
Class AbstractAuthenticationHandler

java.lang.Object
  extended by org.apache.sling.auth.core.spi.DefaultAuthenticationFeedbackHandler
      extended by org.apache.sling.auth.core.spi.AbstractAuthenticationHandler
All Implemented Interfaces:
AuthenticationFeedbackHandler, AuthenticationHandler

public abstract class AbstractAuthenticationHandler
extends DefaultAuthenticationFeedbackHandler
implements AuthenticationHandler

The AbstractAuthenticationHandler implements the AuthenticationHandler interface and extends the DefaultAuthenticationFeedbackHandler providing some helper methods which may be used by authentication handlers.


Field Summary
 
Fields inherited from interface org.apache.sling.auth.core.spi.AuthenticationHandler
PATH_PROPERTY, REQUEST_LOGIN_PARAMETER, SERVICE_NAME, TYPE_PROPERTY
 
Constructor Summary
AbstractAuthenticationHandler()
           
 
Method Summary
static java.lang.String getAttributeOrParameter(javax.servlet.http.HttpServletRequest request, java.lang.String name, java.lang.String defaultValue)
          Returns the value of the named request attribute or parameter as a string as follows: If there is a request attribute of that name, which is a non-empty string, it is returned.
static java.lang.String getLoginResource(javax.servlet.http.HttpServletRequest request, java.lang.String defaultLoginResource)
          Returns any resource target to redirect to after successful authentication.
 
Methods inherited from class org.apache.sling.auth.core.spi.DefaultAuthenticationFeedbackHandler
authenticationFailed, authenticationSucceeded, handleRedirect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.sling.auth.core.spi.AuthenticationHandler
dropCredentials, extractCredentials, requestCredentials
 

Constructor Detail

AbstractAuthenticationHandler

public AbstractAuthenticationHandler()
Method Detail

getAttributeOrParameter

public static java.lang.String getAttributeOrParameter(javax.servlet.http.HttpServletRequest request,
                                                       java.lang.String name,
                                                       java.lang.String defaultValue)
Returns the value of the named request attribute or parameter as a string as follows:
  1. If there is a request attribute of that name, which is a non-empty string, it is returned.
  2. If there is a non-empty request parameter of that name, this parameter is returned.
  3. Otherwise the defaultValue is returned.

    Parameters:
    request - The request from which to return the attribute or request parameter
    name - The name of the attribute/parameter
    defaultValue - The default value to use if neither a non-empty string attribute or a non-empty parameter exists in the request.
    Returns:
    The attribute, parameter or defaultValue as defined above.

getLoginResource

public static java.lang.String getLoginResource(javax.servlet.http.HttpServletRequest request,
                                                java.lang.String defaultLoginResource)
Returns any resource target to redirect to after successful authentication. This method either returns a non-empty string or the defaultLoginResource parameter. First the resource request attribute is checked. If it is a non-empty string, it is returned. Second the resource request parameter is checked and returned if it is a non-empty string.

Parameters:
request - The request providing the attribute or parameter
defaultLoginResource - The default login resource value
Returns:
The non-empty redirection target or defaultLoginResource.


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.