org.alfresco.repo.security.authentication
Class AbstractAuthenticationComponent

java.lang.Object
  extended by org.alfresco.repo.security.authentication.AbstractAuthenticationComponent
All Implemented Interfaces:
AuthenticationComponent
Direct Known Subclasses:
AuthenticationComponentImpl, JAASAuthenticationComponent, LDAPAuthenticationComponentImpl, NTLMAuthenticationComponentImpl, SimpleAcceptOrRejectAllAuthenticationComponentImpl

public abstract class AbstractAuthenticationComponent
extends java.lang.Object
implements AuthenticationComponent

This class abstract the support required to set up and query the Acegi context for security enforcement. There are some simple default method implementations to support simple authentication.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.security.authentication.AuthenticationComponent
AuthenticationComponent.UserNameValidationMode
 
Constructor Summary
AbstractAuthenticationComponent()
           
 
Method Summary
 net.sf.acegisecurity.Authentication authenticate(net.sf.acegisecurity.Authentication token)
          The default is not to support Authentication token base authentication
 void authenticate(java.lang.String userName, char[] password)
          Authenticate
protected  void authenticateImpl(java.lang.String userName, char[] password)
          Default unsupported authentication implementation - as of 2.1 this is the best way to implement your own authentication component as it will support guest login - prior to this direct over ride for authenticate(String , char[]) was used.
 void clearCurrentSecurityContext()
          Remove the current security information
 java.lang.Boolean getAllowGuestLogin()
           
 net.sf.acegisecurity.Authentication getCurrentAuthentication()
          Get the current authentication context
 java.lang.String getCurrentUserName()
          Get the current user name.
 java.lang.String getGuestUserName()
          Get the name of the Guest User note: for MT, will get guest for default domain only
 java.lang.String getMD4HashedPassword(java.lang.String userName)
          The should only be supported if getNTLMMode() is NTLMMode.MD4_PROVIDER.
 NodeService getNodeService()
           
 NTLMMode getNTLMMode()
          Get the NTML mode - none - supports MD4 hash to integrate - or it can asct as an NTLM authentication
 PersonService getPersonService()
           
 java.lang.String getSystemUserName()
          Get the name of the system user note: for MT, will get system for default domain only
 TransactionService getTransactionService()
           
protected  net.sf.acegisecurity.UserDetails getUserDetails(java.lang.String userName)
          Default implementation that makes an ACEGI object on the fly
 boolean guestUserAuthenticationAllowed()
          True if Guest user authentication is allowed, false otherwise
protected abstract  boolean implementationAllowsGuestLogin()
           
 boolean isSystemUserName(java.lang.String userName)
          Is this the system user ?
 void setAllowGuestLogin(java.lang.Boolean allowGuestLogin)
          Set if guest login is supported.
 net.sf.acegisecurity.Authentication setCurrentAuthentication(net.sf.acegisecurity.Authentication authentication)
          Explicitly set the current suthentication.
 net.sf.acegisecurity.Authentication setCurrentUser(java.lang.String userName)
          Explicitly set the current user to be authenticated.
 net.sf.acegisecurity.Authentication setCurrentUser(java.lang.String userName, AuthenticationComponent.UserNameValidationMode validationMode)
          Explicitly set the current user to be authenticated.
 net.sf.acegisecurity.Authentication setGuestUserAsCurrentUser()
          Set the guest user as the current user.
 void setNodeService(NodeService nodeService)
           
 void setPersonService(PersonService personService)
           
 net.sf.acegisecurity.Authentication setSystemUserAsCurrentUser()
          Set the system user as the current user note: for MT, will set to default domain only
 void setTenantService(TenantService tenantService)
           
 void setTransactionService(TransactionService transactionService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAuthenticationComponent

public AbstractAuthenticationComponent()
Method Detail

setAllowGuestLogin

public void setAllowGuestLogin(java.lang.Boolean allowGuestLogin)
Set if guest login is supported.

Parameters:
allowGuestLogin -

setTenantService

public void setTenantService(TenantService tenantService)

setPersonService

public void setPersonService(PersonService personService)

setNodeService

public void setNodeService(NodeService nodeService)

setTransactionService

public void setTransactionService(TransactionService transactionService)

getTransactionService

public TransactionService getTransactionService()

getAllowGuestLogin

public java.lang.Boolean getAllowGuestLogin()

getNodeService

public NodeService getNodeService()

getPersonService

public PersonService getPersonService()

authenticate

public void authenticate(java.lang.String userName,
                         char[] password)
                  throws AuthenticationException
Description copied from interface: AuthenticationComponent
Authenticate

Specified by:
authenticate in interface AuthenticationComponent
Throws:
AuthenticationException

authenticateImpl

protected void authenticateImpl(java.lang.String userName,
                                char[] password)
Default unsupported authentication implementation - as of 2.1 this is the best way to implement your own authentication component as it will support guest login - prior to this direct over ride for authenticate(String , char[]) was used. This will still work.

Parameters:
userName -
password -

setCurrentUser

public net.sf.acegisecurity.Authentication setCurrentUser(java.lang.String userName,
                                                          AuthenticationComponent.UserNameValidationMode validationMode)
Description copied from interface: AuthenticationComponent
Explicitly set the current user to be authenticated. Specify if the userName is to be checked and fixed

Specified by:
setCurrentUser in interface AuthenticationComponent

setCurrentUser

public net.sf.acegisecurity.Authentication setCurrentUser(java.lang.String userName)
                                                   throws AuthenticationException
Description copied from interface: AuthenticationComponent
Explicitly set the current user to be authenticated.

Specified by:
setCurrentUser in interface AuthenticationComponent
Throws:
AuthenticationException

getUserDetails

protected net.sf.acegisecurity.UserDetails getUserDetails(java.lang.String userName)
Default implementation that makes an ACEGI object on the fly

Parameters:
userName -
Returns:

setCurrentAuthentication

public net.sf.acegisecurity.Authentication setCurrentAuthentication(net.sf.acegisecurity.Authentication authentication)
Explicitly set the current suthentication. If the authentication is null the the current authentication is cleared.

Specified by:
setCurrentAuthentication in interface AuthenticationComponent
Parameters:
authentication - the current authentication (may be null).
Returns:
Returns the modified authentication instance or null if it was cleared.

getCurrentAuthentication

public net.sf.acegisecurity.Authentication getCurrentAuthentication()
                                                             throws AuthenticationException
Get the current authentication context

Specified by:
getCurrentAuthentication in interface AuthenticationComponent
Returns:
Authentication
Throws:
AuthenticationException

getCurrentUserName

public java.lang.String getCurrentUserName()
                                    throws AuthenticationException
Get the current user name.

Specified by:
getCurrentUserName in interface AuthenticationComponent
Returns:
String
Throws:
AuthenticationException

setSystemUserAsCurrentUser

public net.sf.acegisecurity.Authentication setSystemUserAsCurrentUser()
Set the system user as the current user note: for MT, will set to default domain only

Specified by:
setSystemUserAsCurrentUser in interface AuthenticationComponent
Returns:
Authentication

getSystemUserName

public java.lang.String getSystemUserName()
Get the name of the system user note: for MT, will get system for default domain only

Specified by:
getSystemUserName in interface AuthenticationComponent
Returns:
String

isSystemUserName

public boolean isSystemUserName(java.lang.String userName)
Is this the system user ?

Specified by:
isSystemUserName in interface AuthenticationComponent
Returns:
boolean

getGuestUserName

public java.lang.String getGuestUserName()
Get the name of the Guest User note: for MT, will get guest for default domain only

Specified by:
getGuestUserName in interface AuthenticationComponent
Returns:
String

setGuestUserAsCurrentUser

public net.sf.acegisecurity.Authentication setGuestUserAsCurrentUser()
                                                              throws AuthenticationException
Set the guest user as the current user. note: for MT, will set to default domain only

Specified by:
setGuestUserAsCurrentUser in interface AuthenticationComponent
Throws:
AuthenticationException

implementationAllowsGuestLogin

protected abstract boolean implementationAllowsGuestLogin()

guestUserAuthenticationAllowed

public boolean guestUserAuthenticationAllowed()
Description copied from interface: AuthenticationComponent
True if Guest user authentication is allowed, false otherwise

Specified by:
guestUserAuthenticationAllowed in interface AuthenticationComponent
Returns:
true if Guest user authentication is allowed, false otherwise

clearCurrentSecurityContext

public void clearCurrentSecurityContext()
Remove the current security information

Specified by:
clearCurrentSecurityContext in interface AuthenticationComponent

authenticate

public net.sf.acegisecurity.Authentication authenticate(net.sf.acegisecurity.Authentication token)
                                                 throws AuthenticationException
The default is not to support Authentication token base authentication

Specified by:
authenticate in interface AuthenticationComponent
Parameters:
token - Authentication
Returns:
Authentication
Throws:
AuthenticationException

getMD4HashedPassword

public java.lang.String getMD4HashedPassword(java.lang.String userName)
The should only be supported if getNTLMMode() is NTLMMode.MD4_PROVIDER.

Specified by:
getMD4HashedPassword in interface AuthenticationComponent

getNTLMMode

public NTLMMode getNTLMMode()
Get the NTML mode - none - supports MD4 hash to integrate - or it can asct as an NTLM authentication

Specified by:
getNTLMMode in interface AuthenticationComponent


Copyright © 2005 - 2008 Alfresco Software, Inc. All Rights Reserved.