org.apache.sling.auth.selector
Class SelectorAuthenticationHandler

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

@Properties(value={@Property(name="service.description",value="Apache Sling Selector Form Handler"),@Property(name="service.vendor",value="The Apache Software Foundation"),@Property(name="path",value="/"),@Property(name="service.ranking",intValue=5000,propertyPrivate=false)})
@Service
public class SelectorAuthenticationHandler
extends AbstractAuthenticationHandler

The SelectorAuthenticationHandler is a pseudo authentication handler which only implements the requestCredentials(HttpServletRequest, HttpServletResponse) method to cause an input form to be rendered for the client to be able to provide credentials.

The default form provided by this handler allows the client to choose from Form Based and OpenID authentication.


Field Summary
 
Fields inherited from interface org.apache.sling.auth.core.spi.AuthenticationHandler
FAILURE_REASON, PATH_PROPERTY, REQUEST_LOGIN_PARAMETER, SERVICE_NAME, TYPE_PROPERTY
 
Constructor Summary
SelectorAuthenticationHandler()
           
 
Method Summary
 void dropCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Nothing to do, this handler does not manage concrete credentials
 AuthenticationInfo extractCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Always returns null because this handler cannot provide credentials from the request.
 boolean requestCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Requests authentication information from the client.
 
Methods inherited from class org.apache.sling.auth.core.spi.AbstractAuthenticationHandler
getAttributeOrParameter, getLoginResource, isValidateRequest, sendInvalid, sendRedirect, sendValid, setLoginResourceAttribute
 
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
 

Constructor Detail

SelectorAuthenticationHandler

public SelectorAuthenticationHandler()
Method Detail

extractCredentials

public AuthenticationInfo extractCredentials(javax.servlet.http.HttpServletRequest request,
                                             javax.servlet.http.HttpServletResponse response)
Always returns null because this handler cannot provide credentials from the request.

Parameters:
request - The request object containing the information for the authentication.
response - The response object which may be used to send the information on the request failure to the user.
Returns:
A valid AuthenticationInfo instance identifying the request user, AuthenticationInfo.DOING_AUTH if the handler is in an authentication transaction with the client or null if the request does not contain authentication information. In case of AuthenticationInfo.DOING_AUTH, the method must have sent a response indicating that fact to the client.

requestCredentials

public boolean requestCredentials(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
Description copied from interface: AuthenticationHandler
Requests authentication information from the client. Returns true if the information has been requested and request processing can be terminated normally. Otherwise the authorization information could not be requested.

The HttpServletResponse.sendError methods should not be used by the implementation because these responses might be post-processed by the servlet container's error handling infrastructure thus preventing the correct operation of the authentication handler. To convey a HTTP response status the HttpServletResponse.setStatus method should be used.

The value of AuthenticationHandler.PATH_PROPERTY service registration property value triggering this call is available as the path request attribute. If the service is registered with multiple path values, the value of the path request attribute may be used to implement specific handling.

If the AuthenticationHandler.REQUEST_LOGIN_PARAMETER request parameter is set only those authentication handlers registered with an authentication type matching the parameter will be considered for requesting credentials through this method.

A handler not registered with an authentication type will, for backwards compatibility reasons, always be called ignoring the actual value of the AuthenticationHandler.REQUEST_LOGIN_PARAMETER parameter.

Parameters:
request - The request object.
response - The response object to which to send the request.
Returns:
true if the handler is able to send an authentication inquiry for the given request. false otherwise.

dropCredentials

public void dropCredentials(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
Nothing to do, this handler does not manage concrete credentials

Parameters:
request - The request object.
response - The response object to which to send the request.


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