net.sf.jguard.authentication
Class XmlAuthenticationManager

java.lang.Object
  extended bynet.sf.jguard.authentication.XmlAuthenticationManager
All Implemented Interfaces:
AuthenticationManager

public class XmlAuthenticationManager
extends java.lang.Object
implements AuthenticationManager

Author:
Charles Gay

Constructor Summary
XmlAuthenticationManager()
           
 
Method Summary
 void addRoleToUser(javax.security.auth.Subject user, java.lang.String roleName)
          add role to user.
 boolean authenticateUser(java.lang.String username, java.lang.String password)
           
 void createRole(JGuardPrincipal role)
          add roles in the list to the persistance storage.
 void createUser(javax.security.auth.Subject user)
          add user in the list to the persistance storage.
 JGuardPrincipal getRole(java.lang.String name)
          retrieve role.
 java.util.List getRoles()
           
 javax.security.auth.Subject getUser(java.lang.String userName)
          retrieve user.
 void initAuthenticationDAO(java.util.Map options)
          initialise the DAO by reading the XML file, and converting it in objects.
 boolean register(javax.security.auth.Subject user)
          register in datasource the user.
 void removeUser(javax.security.auth.Subject userinterface)
          remove user.
 java.util.Set retrieveUserRoles(long Id)
           
 boolean roleAlreadyExists(JGuardPrincipal adminRole)
           
 void updateUser(javax.security.auth.Subject userinterface)
          update user's informations.
 boolean userAlreadyExists(javax.security.auth.Subject user)
          checks if a user with the same username already exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlAuthenticationManager

public XmlAuthenticationManager()
Method Detail

createUser

public void createUser(javax.security.auth.Subject user)
                throws AuthenticationException
Description copied from interface: AuthenticationManager
add user in the list to the persistance storage.

Specified by:
createUser in interface AuthenticationManager
Parameters:
user -
Throws:
AuthenticationException

addRoleToUser

public void addRoleToUser(javax.security.auth.Subject user,
                          java.lang.String roleName)
                   throws AuthenticationException
Description copied from interface: AuthenticationManager
add role to user.

Specified by:
addRoleToUser in interface AuthenticationManager
Parameters:
user -
roleName -
Throws:
AuthenticationException

createRole

public void createRole(JGuardPrincipal role)
                throws AuthenticationException
Description copied from interface: AuthenticationManager
add roles in the list to the persistance storage.

Specified by:
createRole in interface AuthenticationManager
Parameters:
role -
Throws:
AuthenticationException

getRole

public JGuardPrincipal getRole(java.lang.String name)
                        throws AuthenticationException
Description copied from interface: AuthenticationManager
retrieve role.

Specified by:
getRole in interface AuthenticationManager
Parameters:
name -
Returns:
roleInterface
Throws:
AuthenticationException

getRoles

public java.util.List getRoles()
                        throws AuthenticationException
Specified by:
getRoles in interface AuthenticationManager
Returns:
role's list.
Throws:
AuthenticationException

getUser

public javax.security.auth.Subject getUser(java.lang.String userName)
                                    throws AuthenticationException
Description copied from interface: AuthenticationManager
retrieve user.

Specified by:
getUser in interface AuthenticationManager
Parameters:
userName -
Returns:
userinterface
Throws:
AuthenticationException

authenticateUser

public boolean authenticateUser(java.lang.String username,
                                java.lang.String password)
                         throws AuthenticationException
Throws:
AuthenticationException

retrieveUserRoles

public java.util.Set retrieveUserRoles(long Id)
                                throws AuthenticationException
Specified by:
retrieveUserRoles in interface AuthenticationManager
Parameters:
Id -
Returns:
roles set
Throws:
AuthenticationException

userAlreadyExists

public boolean userAlreadyExists(javax.security.auth.Subject user)
                          throws AuthenticationException
Description copied from interface: AuthenticationManager
checks if a user with the same username already exists.

Specified by:
userAlreadyExists in interface AuthenticationManager
Parameters:
user -
Returns:
result. true if a user with the same name exists, false otherwise.
Throws:
AuthenticationException

register

public boolean register(javax.security.auth.Subject user)
                 throws AuthenticationException
Description copied from interface: AuthenticationManager
register in datasource the user.

Specified by:
register in interface AuthenticationManager
Parameters:
user -
Returns:
boolean
Throws:
AuthenticationException

initAuthenticationDAO

public void initAuthenticationDAO(java.util.Map options)
                           throws AuthenticationException
initialise the DAO by reading the XML file, and converting it in objects.

Specified by:
initAuthenticationDAO in interface AuthenticationManager
Throws:
AuthenticationException
See Also:
AuthenticationManager.initAuthenticationDAO(java.util.Map)

roleAlreadyExists

public boolean roleAlreadyExists(JGuardPrincipal adminRole)
                          throws AuthenticationException
Specified by:
roleAlreadyExists in interface AuthenticationManager
Parameters:
adminRole -
Returns:
indicates if role exists
Throws:
AuthenticationException

updateUser

public void updateUser(javax.security.auth.Subject userinterface)
                throws AuthenticationException
Description copied from interface: AuthenticationManager
update user's informations.

Specified by:
updateUser in interface AuthenticationManager
Parameters:
userinterface -
Throws:
AuthenticationException

removeUser

public void removeUser(javax.security.auth.Subject userinterface)
                throws AuthenticationException
Description copied from interface: AuthenticationManager
remove user.

Specified by:
removeUser in interface AuthenticationManager
Parameters:
userinterface -
Throws:
AuthenticationException