org.apache.sling.auth.core.impl
Class AbstractAuthenticationHandlerHolder

java.lang.Object
  extended by org.apache.sling.auth.core.impl.PathBasedHolder
      extended by org.apache.sling.auth.core.impl.AbstractAuthenticationHandlerHolder
All Implemented Interfaces:
Comparable<PathBasedHolder>, AuthenticationHandler
Direct Known Subclasses:
EngineAuthenticationHandlerHolder

public abstract class AbstractAuthenticationHandlerHolder
extends PathBasedHolder
implements AuthenticationHandler

The AbstractAuthenticationHandlerHolder is a base class to represent authentication handlers (both legacy and new ones) for use in the SlingAuthenticator.


Field Summary
 
Fields inherited from class org.apache.sling.auth.core.impl.PathBasedHolder
fullPath
 
Fields inherited from interface org.apache.sling.auth.core.spi.AuthenticationHandler
FAILURE_REASON, PATH_PROPERTY, REQUEST_LOGIN_PARAMETER, SERVICE_NAME, TYPE_PROPERTY
 
Constructor Summary
protected AbstractAuthenticationHandlerHolder(String fullPath, org.osgi.framework.ServiceReference serviceReference)
           
 
Method Summary
protected abstract  void doDropCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Calls the actual authentication handler to request the credentials from the client.
protected abstract  AuthenticationInfo doExtractCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Calls the actual authentication handler to extract the credentials from the request.
protected abstract  boolean doRequestCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Calls the actual authentication handler to request the credentials from the client.
 void dropCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Sets the AuthenticationHandler.PATH_PROPERTY request attribute to this PathBasedHolder.fullPath and calls the doDropCredentials(HttpServletRequest, HttpServletResponse) to have the credentials dropped by the held authentication handler.
 AuthenticationInfo extractCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Sets the AuthenticationHandler.PATH_PROPERTY request attribute to this PathBasedHolder.fullPath and calls the extractCredentials(HttpServletRequest, HttpServletResponse) to have the credentials extracted from the request.
protected abstract  AuthenticationFeedbackHandler getFeedbackHandler()
          Returns a feedback handler provided by the authentication handler held by this instance or null if none is provided.
 boolean requestCredentials(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Sets the AuthenticationHandler.PATH_PROPERTY request attribute to this PathBasedHolder.fullPath and calls the doRequestCredentials(HttpServletRequest, HttpServletResponse) to have the credentials requested from the client.
 
Methods inherited from class org.apache.sling.auth.core.impl.PathBasedHolder
compareTo, equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAuthenticationHandlerHolder

protected AbstractAuthenticationHandlerHolder(String fullPath,
                                              org.osgi.framework.ServiceReference serviceReference)
Method Detail

extractCredentials

public final AuthenticationInfo extractCredentials(javax.servlet.http.HttpServletRequest request,
                                                   javax.servlet.http.HttpServletResponse response)
Sets the AuthenticationHandler.PATH_PROPERTY request attribute to this PathBasedHolder.fullPath and calls the extractCredentials(HttpServletRequest, HttpServletResponse) to have the credentials extracted from the request.

Specified by:
extractCredentials in interface AuthenticationHandler
Parameters:
request - the current request
response - the current response
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 final boolean requestCredentials(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws IOException
Sets the AuthenticationHandler.PATH_PROPERTY request attribute to this PathBasedHolder.fullPath and calls the doRequestCredentials(HttpServletRequest, HttpServletResponse) to have the credentials requested from the client.

Specified by:
requestCredentials in interface AuthenticationHandler
Parameters:
request - the current request
response - the current response
Returns:
true if the handler is able to send an authentication inquiry for the given request. false otherwise.
Throws:
IOException - if an error occurrs interacting with the client

dropCredentials

public final void dropCredentials(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
                           throws IOException
Sets the AuthenticationHandler.PATH_PROPERTY request attribute to this PathBasedHolder.fullPath and calls the doDropCredentials(HttpServletRequest, HttpServletResponse) to have the credentials dropped by the held authentication handler.

Specified by:
dropCredentials in interface AuthenticationHandler
Parameters:
request - the current request
response - the current response
Throws:
IOException - if an error occurrs interacting with the client

getFeedbackHandler

protected abstract AuthenticationFeedbackHandler getFeedbackHandler()
Returns a feedback handler provided by the authentication handler held by this instance or null if none is provided.


doExtractCredentials

protected abstract AuthenticationInfo doExtractCredentials(javax.servlet.http.HttpServletRequest request,
                                                           javax.servlet.http.HttpServletResponse response)
Calls the actual authentication handler to extract the credentials from the request.

Parameters:
request - The current request
response - The current response
Returns:
as returned from the called authentication handler
See Also:
extractCredentials(HttpServletRequest, HttpServletResponse)

doRequestCredentials

protected abstract boolean doRequestCredentials(javax.servlet.http.HttpServletRequest request,
                                                javax.servlet.http.HttpServletResponse response)
                                         throws IOException
Calls the actual authentication handler to request the credentials from the client.

Parameters:
request - The current request
response - The current response
Returns:
as returned from the called authentication handler
Throws:
IOException - if an error occurrs sending back any response to the client.
See Also:
requestCredentials(HttpServletRequest, HttpServletResponse)

doDropCredentials

protected abstract void doDropCredentials(javax.servlet.http.HttpServletRequest request,
                                          javax.servlet.http.HttpServletResponse response)
                                   throws IOException
Calls the actual authentication handler to request the credentials from the client.

Parameters:
request - The current request
response - The current response
Throws:
IOException - if an error occurrs sending back any response to the client.
See Also:
dropCredentials(HttpServletRequest, HttpServletResponse)


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