net.sf.jguard.ext.authentication.manager
Class XmlAuthenticationManager

java.lang.Object
  extended by net.sf.jguard.ext.authentication.manager.AbstractAuthenticationManager
      extended by net.sf.jguard.ext.authentication.manager.XmlAuthenticationManager
All Implemented Interfaces:
net.sf.jguard.core.authentication.manager.AuthenticationManager

public class XmlAuthenticationManager
extends AbstractAuthenticationManager
implements net.sf.jguard.core.authentication.manager.AuthenticationManager

AuthenticationManager implementation which persists in an XML repository file.

Author:
Charles Gay, Maximiliano Batelli

Field Summary
static java.lang.String AUTHENTICATION
           
 
Fields inherited from class net.sf.jguard.ext.authentication.manager.AbstractAuthenticationManager
applicationName, debug, defaultOrganization, localPrincipals, localPrincipalsSet, organizations, organizationTemplate
 
Constructor Summary
XmlAuthenticationManager(java.util.Map options)
          initialise the DAO by reading the XML file, and converting it in objects.
 
Method Summary
 void deleteOrganization(net.sf.jguard.core.organization.Organization organisation)
           
 boolean deletePrincipal(java.security.Principal principal)
           
 void deleteUser(javax.security.auth.Subject user)
          remove the user from the XML repository.
 void exportAsXMLFile(java.lang.String fileName)
           
 java.lang.String exportAsXMLString()
           
 net.sf.jguard.core.organization.Organization findOrganization(java.lang.String organizationId)
           
 java.util.Collection findOrganizations(java.util.Collection credentials)
           
 java.util.Set findUsers(java.util.Collection privateCredentials, java.util.Collection publicCredentials)
          search the users which matches credentials criterions.
 java.util.Set getAllPrincipalsSet()
           
 java.util.Set getOrganizations()
           
 net.sf.jguard.core.provisioning.SubjectTemplate getSubjectTemplate(org.dom4j.Element organizationNode)
          construct from configuration file the subjectTemplate.
 java.util.Set getUsers()
           
 boolean isEmpty()
           
protected  void persistOrganization(net.sf.jguard.core.organization.Organization organization)
          persist role in the datasource backend.
protected  void persistPrincipal(java.security.Principal principal)
          persist principal in the XML repository.
 void persistSubjectTemplate(org.dom4j.Element organizationElement, net.sf.jguard.core.provisioning.SubjectTemplate template)
          define and persist the SubjectTemplate for registration.
protected  void persistUser(javax.security.auth.Subject user)
          persist user into the XML repository file.
 void persistUserLoginAttempt(java.lang.String login, java.lang.String hostAddress, java.lang.String hostName, boolean succeeded, long timeStamp)
           
 void persistUserLogoutAttempt(java.lang.String login, java.lang.String hostAddress, java.lang.String hostName, long timeStamp)
           
 void setOrganizationTemplate(net.sf.jguard.core.provisioning.OrganizationTemplate organizationTemplate)
           
 void updateOrganization(java.lang.String organizationId, net.sf.jguard.core.organization.Organization organization)
           
 void updatePrincipal(java.lang.String oldPrincipalName, java.security.Principal principal)
           
protected  void updateUserImpl(net.sf.jguard.core.authentication.credentials.JGuardCredential identityCred, javax.security.auth.Subject user)
          update user's informations in the XML repository file.
 void writeAsHTML(java.io.OutputStream outputStream)
           
 void writeAsXML(java.io.OutputStream outputStream, java.lang.String encodingScheme)
           
 
Methods inherited from class net.sf.jguard.ext.authentication.manager.AbstractAuthenticationManager
addPrincipalToUser, addPrincipalToUser, clonePrincipal, clonePrincipal, createOrganization, createOrganization, createPrincipal, createUser, createUser, extractCredentials, extractCredentialsFromSubject, extractIdentityCredentialFromUser, findUser, getApplicationName, getCredentialId, getCredentialPassword, getDefaultOrganization, getLocalPrincipal, getLocalPrincipals, getOrganizationTemplate, getRole, hasPrincipal, hasPrincipal, importAuthenticationManager, importXmlData, isRole, isRoleAndLocal, organizationAlreadyExists, setActiveOnRolePrincipal, updateRoleDefinition, updateUser, userAlreadyExists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jguard.core.authentication.manager.AuthenticationManager
clonePrincipal, clonePrincipal, createOrganization, createPrincipal, createUser, createUser, findUser, getApplicationName, getCredentialId, getCredentialPassword, getDefaultOrganization, getLocalPrincipal, getLocalPrincipals, getOrganizationTemplate, hasPrincipal, hasPrincipal, importAuthenticationManager, setActiveOnRolePrincipal, updateRoleDefinition, updateUser, userAlreadyExists
 

Field Detail

AUTHENTICATION

public static final java.lang.String AUTHENTICATION
See Also:
Constant Field Values
Constructor Detail

XmlAuthenticationManager

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

See Also:
net.sf.jguard.core.authentication.manager.AuthenticationManager#init(java.util.Map)
Method Detail

persistPrincipal

protected void persistPrincipal(java.security.Principal principal)
                         throws net.sf.jguard.core.authentication.AuthenticationException
persist principal in the XML repository.

Specified by:
persistPrincipal in class AbstractAuthenticationManager
Parameters:
principal - to persist
Throws:
net.sf.jguard.core.authentication.AuthenticationException
See Also:
net.sf.jguard.core.authentication.manager.AuthenticationManager#createPrincipal(net.sf.jguard.core.principals.RolePrincipal)

updateUserImpl

protected void updateUserImpl(net.sf.jguard.core.authentication.credentials.JGuardCredential identityCred,
                              javax.security.auth.Subject user)
                       throws net.sf.jguard.core.authentication.AuthenticationException
update user's informations in the XML repository file.

Specified by:
updateUserImpl in class AbstractAuthenticationManager
Throws:
net.sf.jguard.core.authentication.AuthenticationException
See Also:
AuthenticationManager.updateUser(JGuardCredential, javax.security.auth.Subject)

deleteUser

public void deleteUser(javax.security.auth.Subject user)
                throws net.sf.jguard.core.authentication.AuthenticationException
remove the user from the XML repository.

Specified by:
deleteUser in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Parameters:
user - to remove
Throws:
net.sf.jguard.core.authentication.AuthenticationException
See Also:
AuthenticationManager.deleteUser(javax.security.auth.Subject)

getSubjectTemplate

public net.sf.jguard.core.provisioning.SubjectTemplate getSubjectTemplate(org.dom4j.Element organizationNode)
construct from configuration file the subjectTemplate.

Returns:
Subject template built
Throws:
net.sf.jguard.core.authentication.AuthenticationException

persistUser

protected void persistUser(javax.security.auth.Subject user)
                    throws net.sf.jguard.core.authentication.AuthenticationException
persist user into the XML repository file.

Specified by:
persistUser in class AbstractAuthenticationManager
Parameters:
user -
Throws:
net.sf.jguard.core.authentication.AuthenticationException

persistSubjectTemplate

public void persistSubjectTemplate(org.dom4j.Element organizationElement,
                                   net.sf.jguard.core.provisioning.SubjectTemplate template)
define and persist the SubjectTemplate for registration.

Parameters:
template -

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Returns:
true if there is no principals and no permissions. false otherwise.

getAllPrincipalsSet

public java.util.Set getAllPrincipalsSet()
Specified by:
getAllPrincipalsSet in interface net.sf.jguard.core.authentication.manager.AuthenticationManager

findUsers

public java.util.Set findUsers(java.util.Collection privateCredentials,
                               java.util.Collection publicCredentials)
search the users which matches credentials criterions.

Specified by:
findUsers in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Specified by:
findUsers in class AbstractAuthenticationManager
Parameters:
credentials - crierions used to grab the users
Returns:
users found

getUsers

public java.util.Set getUsers()
Specified by:
getUsers in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Specified by:
getUsers in class AbstractAuthenticationManager

updatePrincipal

public void updatePrincipal(java.lang.String oldPrincipalName,
                            java.security.Principal principal)
Specified by:
updatePrincipal in interface net.sf.jguard.core.authentication.manager.AuthenticationManager

deletePrincipal

public boolean deletePrincipal(java.security.Principal principal)
                        throws net.sf.jguard.core.authentication.AuthenticationException
Specified by:
deletePrincipal in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Throws:
net.sf.jguard.core.authentication.AuthenticationException

exportAsXMLString

public java.lang.String exportAsXMLString()

writeAsXML

public void writeAsXML(java.io.OutputStream outputStream,
                       java.lang.String encodingScheme)
                throws java.io.IOException
Throws:
java.io.IOException

writeAsHTML

public void writeAsHTML(java.io.OutputStream outputStream)
                 throws java.io.IOException
Throws:
java.io.IOException

exportAsXMLFile

public void exportAsXMLFile(java.lang.String fileName)
                     throws java.io.IOException
Throws:
java.io.IOException

persistUserLoginAttempt

public void persistUserLoginAttempt(java.lang.String login,
                                    java.lang.String hostAddress,
                                    java.lang.String hostName,
                                    boolean succeeded,
                                    long timeStamp)
                             throws net.sf.jguard.core.authentication.AuthenticationException
Specified by:
persistUserLoginAttempt in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Throws:
net.sf.jguard.core.authentication.AuthenticationException

persistUserLogoutAttempt

public void persistUserLogoutAttempt(java.lang.String login,
                                     java.lang.String hostAddress,
                                     java.lang.String hostName,
                                     long timeStamp)
                              throws net.sf.jguard.core.authentication.AuthenticationException
Specified by:
persistUserLogoutAttempt in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Throws:
net.sf.jguard.core.authentication.AuthenticationException

deleteOrganization

public void deleteOrganization(net.sf.jguard.core.organization.Organization organisation)
Specified by:
deleteOrganization in interface net.sf.jguard.core.authentication.manager.AuthenticationManager

updateOrganization

public void updateOrganization(java.lang.String organizationId,
                               net.sf.jguard.core.organization.Organization organization)
                        throws net.sf.jguard.core.authentication.AuthenticationException
Specified by:
updateOrganization in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Throws:
net.sf.jguard.core.authentication.AuthenticationException

findOrganization

public net.sf.jguard.core.organization.Organization findOrganization(java.lang.String organizationId)
Specified by:
findOrganization in interface net.sf.jguard.core.authentication.manager.AuthenticationManager

persistOrganization

protected void persistOrganization(net.sf.jguard.core.organization.Organization organization)
                            throws net.sf.jguard.core.authentication.AuthenticationException
Description copied from class: AbstractAuthenticationManager
persist role in the datasource backend.

Specified by:
persistOrganization in class AbstractAuthenticationManager
Throws:
net.sf.jguard.core.authentication.AuthenticationException

getOrganizations

public java.util.Set getOrganizations()
                               throws net.sf.jguard.core.authentication.AuthenticationException
Specified by:
getOrganizations in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Throws:
net.sf.jguard.core.authentication.AuthenticationException

findOrganizations

public java.util.Collection findOrganizations(java.util.Collection credentials)
                                       throws net.sf.jguard.core.authentication.AuthenticationException
Throws:
net.sf.jguard.core.authentication.AuthenticationException

setOrganizationTemplate

public void setOrganizationTemplate(net.sf.jguard.core.provisioning.OrganizationTemplate organizationTemplate)
                             throws net.sf.jguard.core.authentication.AuthenticationException
Specified by:
setOrganizationTemplate in interface net.sf.jguard.core.authentication.manager.AuthenticationManager
Specified by:
setOrganizationTemplate in class AbstractAuthenticationManager
Throws:
net.sf.jguard.core.authentication.AuthenticationException


Copyright © 2004-2009. All Rights Reserved.