org.springframework.extensions.surf.support
Class AbstractUserFactory

java.lang.Object
  extended by org.springframework.extensions.surf.support.BaseFactory
      extended by org.springframework.extensions.surf.support.AbstractUserFactory
All Implemented Interfaces:
org.springframework.context.ApplicationContextAware, UserFactory
Direct Known Subclasses:
AlfrescoUserFactory, DefaultUserFactory

public abstract class AbstractUserFactory
extends BaseFactory
implements UserFactory

Abstract base class for UserFactory implementations. This is provided as a convenience to developers who wish to build their own custom UserFactory variations.

Author:
muzquiano, Kevin Roast

Field Summary
 
Fields inherited from interface org.springframework.extensions.surf.UserFactory
SESSION_ATTRIBUTE_EXTERNAL_AUTH, SESSION_ATTRIBUTE_KEY_USER_ID, SESSION_ATTRIBUTE_KEY_USER_OBJECT, USER_GUEST
 
Constructor Summary
AbstractUserFactory()
           
 
Method Summary
abstract  boolean authenticate(javax.servlet.http.HttpServletRequest request, String username, String password)
          Authentication the user given the supplied username/password
 User faultUser(RequestContext context, javax.servlet.http.HttpServletRequest request)
          Loads a user from the remote user store and store it into the session.
 User faultUser(RequestContext context, javax.servlet.http.HttpServletRequest request, boolean force)
          Loads a user from the remote user store and stores it into the session.
 User faultUser(RequestContext context, javax.servlet.http.HttpServletRequest request, String endpoint)
          Loads a user from the remote user store and store it into the session.
 User faultUser(RequestContext context, javax.servlet.http.HttpServletRequest request, String endpoint, boolean force)
          Loads a user from the remote user store and stores it into the session.
protected  User getGuestUser(RequestContext context)
          Retrieve the special "Guest" user instance.
abstract  User loadUser(RequestContext context, String userId)
          Load the user from a store
abstract  User loadUser(RequestContext context, String userId, String endpointId)
          Load the user from a store
 
Methods inherited from class org.springframework.extensions.surf.support.BaseFactory
getApplicationContext, getResourceService, getServiceRegistry, getWebFrameworkConfiguration, getWebFrameworkManager, setApplicationContext, setServiceRegistry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractUserFactory

public AbstractUserFactory()
Method Detail

getGuestUser

protected User getGuestUser(RequestContext context)
                     throws UserFactoryException
Retrieve the special "Guest" user instance.

Parameters:
context -
Returns:
Guest User
Throws:
UserFactoryException

faultUser

public User faultUser(RequestContext context,
                      javax.servlet.http.HttpServletRequest request)
               throws UserFactoryException
Loads a user from the remote user store and store it into the session.

Specified by:
faultUser in interface UserFactory
Parameters:
context -
request -
Returns:
User
Throws:
UserFactoryException

faultUser

public User faultUser(RequestContext context,
                      javax.servlet.http.HttpServletRequest request,
                      String endpoint)
               throws UserFactoryException
Loads a user from the remote user store and store it into the session.

Specified by:
faultUser in interface UserFactory
Parameters:
context -
request -
Returns:
User
Throws:
UserFactoryException

faultUser

public User faultUser(RequestContext context,
                      javax.servlet.http.HttpServletRequest request,
                      boolean force)
               throws UserFactoryException
Loads a user from the remote user store and stores it into the session. If the force flag is set, the current in-session user object will be purged, forcing the user object to reload.

Specified by:
faultUser in interface UserFactory
Parameters:
context -
request -
force -
Returns:
User
Throws:
UserFactoryException

faultUser

public User faultUser(RequestContext context,
                      javax.servlet.http.HttpServletRequest request,
                      String endpoint,
                      boolean force)
               throws UserFactoryException
Loads a user from the remote user store and stores it into the session. If the force flag is set, the current in-session user object will be purged, forcing the user object to reload.

Specified by:
faultUser in interface UserFactory
Parameters:
context -
request -
force -
Returns:
User
Throws:
UserFactoryException

loadUser

public abstract User loadUser(RequestContext context,
                              String userId)
                       throws UserFactoryException
Load the user from a store

Specified by:
loadUser in interface UserFactory
Parameters:
context -
userId -
Returns:
User
Throws:
UserFactoryException

loadUser

public abstract User loadUser(RequestContext context,
                              String userId,
                              String endpointId)
                       throws UserFactoryException
Load the user from a store

Specified by:
loadUser in interface UserFactory
Parameters:
context -
userId -
endpointId -
Returns:
User
Throws:
UserFactoryException

authenticate

public abstract boolean authenticate(javax.servlet.http.HttpServletRequest request,
                                     String username,
                                     String password)
Authentication the user given the supplied username/password

Specified by:
authenticate in interface UserFactory
Parameters:
request -
username -
password -
Returns:
success/failure


Copyright © 2009 SpringSource, Inc. All Rights Reserved.