net.sf.jguard.core.authentication.manager
Interface AuthenticationManager


public interface AuthenticationManager

this interface provide the ability to operate on the system which stores user profiles. it can be a database, or an ldap server, or anything else.... it concerns administrators guys. there is one AuthenticationManager per webapp.

Author:
Charles Gay, Maximiliano Batelli

Method Summary
 java.security.Principal clonePrincipal(java.lang.String roleName)
          Clone a Principal with a random name
 java.security.Principal clonePrincipal(java.lang.String roleName, java.lang.String cloneName)
          Clone a Principal.
 Organization createOrganization(OrganizationTemplate organizationTemplate)
           
 void createPrincipal(java.security.Principal role)
          add principals in the list to the persistance storage.
 javax.security.auth.Subject createUser(javax.security.auth.Subject user, Organization organization)
           
 javax.security.auth.Subject createUser(SubjectTemplate user, Organization organization)
           
 void deleteOrganization(Organization organisation)
           
 boolean deletePrincipal(java.security.Principal principal)
          delete this principal and its references in users.
 void deleteUser(javax.security.auth.Subject user)
          remove user.
 Organization findOrganization(java.lang.String organizationId)
           
 javax.security.auth.Subject findUser(java.lang.String login)
           
 java.util.Set findUsers(java.util.Collection privateCredentials, java.util.Collection publicCredentials)
          retrieve users which are in conformance with all these credentials.
 java.util.Set getAllPrincipalsSet()
          get the principals defined in the repository for all the applications.
 java.lang.String getApplicationName()
          define the name of the current application which holds this AuthenticationManager.
 java.lang.String getCredentialId()
           
 java.lang.String getCredentialPassword()
           
 Organization getDefaultOrganization()
          return the default Organization identified by the id system.
 java.security.Principal getLocalPrincipal(java.lang.String name)
          retrieve role from the webapp.
 java.util.Set getLocalPrincipals()
          get the principals defined in the repository only for this application.
 java.util.Set getOrganizations()
           
 OrganizationTemplate getOrganizationTemplate()
          return the OrganizationTemplate.
 java.util.Set getUsers()
           
 boolean hasPrincipal(java.security.Principal role)
          role wether or not exists in the webapp.
 boolean hasPrincipal(java.lang.String role)
          role wether or not exists in the webapp.
 void importAuthenticationManager(AuthenticationManager authManager)
           
 boolean isEmpty()
           
 void persistUserLoginAttempt(java.lang.String login, java.lang.String hostAddress, java.lang.String hostName, boolean succeeded, long timeStamp)
          Persists a user logon attempt.
 void persistUserLogoutAttempt(java.lang.String login, java.lang.String hostAddress, java.lang.String hostName, long timeStamp)
          Persists a user logon attempt.
 void setActiveOnRolePrincipal(javax.security.auth.Subject subject, java.lang.String roleName, java.lang.String applicationName, boolean active)
          change 'active' property on the specified role for a user.
 void setOrganizationTemplate(OrganizationTemplate organizationTemplate)
           
 void updateOrganization(java.lang.String organizationIdentityCredential, Organization organisation)
           
 void updatePrincipal(java.lang.String oldPrincipalName, java.security.Principal principal)
          change principal's name.
 void updateRoleDefinition(javax.security.auth.Subject subject, java.lang.String role, java.lang.String applicationName, java.lang.String definition)
           
 void updateUser(JGuardCredential identityCred, javax.security.auth.Subject user)
          update user's informations.
 boolean userAlreadyExists(javax.security.auth.Subject user)
          checks if a user with the same username already exists.
 

Method Detail

createOrganization

Organization createOrganization(OrganizationTemplate organizationTemplate)
                                throws RegistrationException
Throws:
RegistrationException

deleteOrganization

void deleteOrganization(Organization organisation)

getDefaultOrganization

Organization getDefaultOrganization()
return the default Organization identified by the id system.


getOrganizations

java.util.Set getOrganizations()
                               throws AuthenticationException
Throws:
AuthenticationException

updateOrganization

void updateOrganization(java.lang.String organizationIdentityCredential,
                        Organization organisation)
                        throws AuthenticationException
Throws:
AuthenticationException

findOrganization

Organization findOrganization(java.lang.String organizationId)
Parameters:
unique - organizationId to find
Returns:
Organization found or null otherwise.

getCredentialId

java.lang.String getCredentialId()

getCredentialPassword

java.lang.String getCredentialPassword()

createPrincipal

void createPrincipal(java.security.Principal role)
                     throws AuthenticationException
add principals in the list to the persistance storage. create a Principal in the backend, only if it is not already present.

Parameters:
role -
Throws:
AuthenticationException

createUser

javax.security.auth.Subject createUser(SubjectTemplate user,
                                       Organization organization)
                                       throws RegistrationException
Parameters:
user - to be controlled
subjectTemplate - is the validator
Throws:
RegistrationException

createUser

javax.security.auth.Subject createUser(javax.security.auth.Subject user,
                                       Organization organization)
                                       throws AuthenticationException
Parameters:
user - to be controlled
subjectTemplate - is the validator
Throws:
AuthenticationException

getLocalPrincipal

java.security.Principal getLocalPrincipal(java.lang.String name)
                                          throws AuthenticationException
retrieve role from the webapp.

Parameters:
name -
Returns:
roleInterface
Throws:
AuthenticationException

getAllPrincipalsSet

java.util.Set getAllPrincipalsSet()
                                  throws AuthenticationException
get the principals defined in the repository for all the applications.

Returns:
role's list.
Throws:
AuthenticationException

getLocalPrincipals

java.util.Set getLocalPrincipals()
get the principals defined in the repository only for this application.

Returns:
role's list.

findUsers

java.util.Set findUsers(java.util.Collection privateCredentials,
                        java.util.Collection publicCredentials)
                        throws AuthenticationException
retrieve users which are in conformance with all these credentials.

Parameters:
credentials -
Returns:
users
Throws:
AuthenticationException

userAlreadyExists

boolean userAlreadyExists(javax.security.auth.Subject user)
                          throws AuthenticationException
checks if a user with the same username already exists.

Parameters:
user -
Returns:
result. true if a user with the same name exists, false otherwise.
Throws:
AuthenticationException

hasPrincipal

boolean hasPrincipal(java.security.Principal role)
                     throws AuthenticationException
role wether or not exists in the webapp.

Parameters:
role - to check
Returns:
result
Throws:
AuthenticationException

hasPrincipal

boolean hasPrincipal(java.lang.String role)
                     throws AuthenticationException
role wether or not exists in the webapp.

Parameters:
role - to check
Returns:
result
Throws:
AuthenticationException

updateUser

void updateUser(JGuardCredential identityCred,
                javax.security.auth.Subject user)
                throws AuthenticationException
update user's informations.

Parameters:
identityCred -
user -
Throws:
AuthenticationException

deleteUser

void deleteUser(javax.security.auth.Subject user)
                throws AuthenticationException
remove user.

Parameters:
user -
Throws:
AuthenticationException

getOrganizationTemplate

OrganizationTemplate getOrganizationTemplate()
                                             throws AuthenticationException
return the OrganizationTemplate.

Parameters:
name -
Returns:
SubjectTemplate
Throws:
AuthenticationException

setOrganizationTemplate

void setOrganizationTemplate(OrganizationTemplate organizationTemplate)
                             throws AuthenticationException
Throws:
AuthenticationException

getUsers

java.util.Set getUsers()
                       throws AuthenticationException
Throws:
AuthenticationException

isEmpty

boolean isEmpty()

updatePrincipal

void updatePrincipal(java.lang.String oldPrincipalName,
                     java.security.Principal principal)
                     throws AuthenticationException
change principal's name.

Parameters:
oldPrincipalName -
principal -
Throws:
AuthenticationException

deletePrincipal

boolean deletePrincipal(java.security.Principal principal)
                        throws AuthenticationException
delete this principal and its references in users.

Parameters:
principal -
Returns:
false i delete fails, true if it succeed
Throws:
AuthenticationException

clonePrincipal

java.security.Principal clonePrincipal(java.lang.String roleName)
                                       throws AuthenticationException
Clone a Principal with a random name

Parameters:
roleName - Principal name to clone
Returns:
cloned Principal with a different name: roleName + Random integer betweeen 0 and 99999
Throws:
AuthenticationException

clonePrincipal

java.security.Principal clonePrincipal(java.lang.String roleName,
                                       java.lang.String cloneName)
                                       throws AuthenticationException
Clone a Principal. If Principal is instance of RolePrincipal makes a call to the clone method leting the clone task to RolePrincipal

Parameters:
roleName - Principal name to clone
cloneName - Principal cloned name
Returns:
cloned Principal with the given cloneName
Throws:
AuthenticationException

setActiveOnRolePrincipal

void setActiveOnRolePrincipal(javax.security.auth.Subject subject,
                              java.lang.String roleName,
                              java.lang.String applicationName,
                              boolean active)
                              throws AuthenticationException
change 'active' property on the specified role for a user. this change cannot be done on 'guest' user, or if it remains only one 'active=true' role.

Parameters:
subject -
roleName -
applicationName -
active -
Throws:
AuthenticationException

findUser

javax.security.auth.Subject findUser(java.lang.String login)

updateRoleDefinition

void updateRoleDefinition(javax.security.auth.Subject subject,
                          java.lang.String role,
                          java.lang.String applicationName,
                          java.lang.String definition)
                          throws AuthenticationException
Throws:
AuthenticationException

importAuthenticationManager

void importAuthenticationManager(AuthenticationManager authManager)

persistUserLoginAttempt

void persistUserLoginAttempt(java.lang.String login,
                             java.lang.String hostAddress,
                             java.lang.String hostName,
                             boolean succeeded,
                             long timeStamp)
                             throws AuthenticationException
Persists a user logon attempt.

Parameters:
login - user unique ID
hostAdress - IP Adress
hostname - DNS Name bound to the IP adress
Throws:
AuthenticationException

persistUserLogoutAttempt

void persistUserLogoutAttempt(java.lang.String login,
                              java.lang.String hostAddress,
                              java.lang.String hostName,
                              long timeStamp)
                              throws AuthenticationException
Persists a user logon attempt.

Parameters:
login - user unique ID
hostAdress - IP Adress
hostname - DNS Name bound to the IP adress
Throws:
AuthenticationException

getApplicationName

java.lang.String getApplicationName()
define the name of the current application which holds this AuthenticationManager.



Copyright © 2004-2009. All Rights Reserved.