atg.security
Class XmlAccountManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.RegisteredService
              extended by atg.security.GenericUserAuthority
                  extended by atg.security.GenericAccountManager
                      extended by atg.security.XmlAccountManager
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, AccountManager, AccountTypes, atg.security.I18nAccountManager, IdUserAuthority, LoginUserAuthority, UserAuthority, UserAuthority2, java.util.EventListener

public class XmlAccountManager
extends GenericAccountManager
implements IdUserAuthority, LoginUserAuthority

An account manager/user authority that loads user account information from an XML file.

This is a fairly simplistic implementation that is best used for small sets of accounts or for prototyping purposes. Its primary limitation is that changes to the accounts are not persistent.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.security.GenericAccountManager
AUTHENTICATED, BAD_ACCOUNT_FAILURE, BAD_PASSWORD_FAILURE, CREATED_ACCOUNT, DEFAULT_GROUP_DOESNT_EXIST, INVALID_ACCOUNT, LOGIN_DISABLED_FAILURE, NO_PASSWORD_FAILURE, REMOVED_ACCOUNT
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.security.AccountTypes
ANY_ACCOUNT, GROUP_ACCOUNT, LOGIN_ACCOUNT, PRIVILEGE_ACCOUNT
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
XmlAccountManager()
           
 
Method Summary
 Account createAccount(java.lang.String pAccountName, int pType, java.util.Map pAttributes)
          Creates a new account with a given set of attributes.
 Account getAccount(java.lang.String pAccountName)
          Version of getAccount() that loads the database if necessary
 atg.xml.XMLFile getAccountFile()
          Returns the name of an XML file from which to obtain user information.
 Persona getPersona(java.lang.Object pId)
          Version of getPersona() that loads the database if necessary.
 atg.xml.tools.XMLToolsFactory getXMLToolsFactory()
          Returns the tools factory that creates an XML parser for this user authority.
 java.util.Iterator listAccounts(int pType)
          Returns an iterator of accounts with a particular set of types.
 java.util.Iterator listMatchingAccounts(java.lang.String pExpression, int pType)
          Lists accounts that match a given expression.
 boolean login(User pUser, java.lang.String pName, java.lang.String pHashedPassword, java.lang.Object pHashKey)
          Authenticates a user, populating the User object with appropriate personae.
 void removeAccount(java.lang.String pAccountName)
          Removes an account with the indicated name, if possible.
 void setAccountFile(atg.xml.XMLFile mXmlFile)
          Sets or changes the name of the XML file from which to obtain user information.
 boolean setPersonaeFor(User pUser, java.lang.String pId)
          Populates a user object with the persona information for the given user ID.
 void setXMLToolsFactory(atg.xml.tools.XMLToolsFactory pNewFactory)
          Sets the tools factory that will be used to create an XML parser for this user authority.
 
Methods inherited from class atg.security.GenericAccountManager
addAccount, clear, doStartService, getAccountInitializer, getAccountIterator, getAttributeResourceBundle, getDefaultLoginGroups, getDescriptionAttribute, getDisplayNameForAttribute, getFirstNameAttribute, getLastNameAttribute, getPasswordAttribute, getPasswordHasher, newAccount, setAccountInitializer, setAccountMatchFields, setAttributeResourceBundle, setDefaultLoginGroups, setDescriptionAttribute, setFirstNameAttribute, setLastNameAttribute, setPasswordAttribute, setPasswordHasher, setUserAuthorityName
 
Methods inherited from class atg.security.GenericUserAuthority
addAuthenticationFailedListener, addAuthenticationSucceededListener, addSpecialPersona, fireAuthenticationFailedEvent, fireAuthenticationSucceededEvent, getProxyUserAuthorities, getSpecialPersonae, getSupportsEveryone, getUserAuthorityName, removeAuthenticationFailedListener, removeAuthenticationSucceededListener, removeSpecialPersona, setProxyUserAuthorities, setSpecialPersonae, setSupportsEveryone, userDestroyed
 
Methods inherited from class atg.nucleus.RegisteredService
addToRegistry, getRegistry, getRegistryName, getServiceName, removeFromRegistry, setRegistryName, setServiceName, startService, stopService
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atg.security.UserAuthority
addAuthenticationFailedListener, addAuthenticationSucceededListener, getUserAuthorityName, removeAuthenticationFailedListener, removeAuthenticationSucceededListener, userDestroyed
 
Methods inherited from interface atg.security.LoginUserAuthority
getPasswordHasher
 
Methods inherited from interface atg.security.UserAuthority
addAuthenticationFailedListener, addAuthenticationSucceededListener, getUserAuthorityName, removeAuthenticationFailedListener, removeAuthenticationSucceededListener, userDestroyed
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

XmlAccountManager

public XmlAccountManager()
Method Detail

getAccountFile

public atg.xml.XMLFile getAccountFile()
Returns the name of an XML file from which to obtain user information.


setAccountFile

public void setAccountFile(atg.xml.XMLFile mXmlFile)
Sets or changes the name of the XML file from which to obtain user information.


getXMLToolsFactory

public atg.xml.tools.XMLToolsFactory getXMLToolsFactory()
Returns the tools factory that creates an XML parser for this user authority.


setXMLToolsFactory

public void setXMLToolsFactory(atg.xml.tools.XMLToolsFactory pNewFactory)
Sets the tools factory that will be used to create an XML parser for this user authority.


getPersona

public Persona getPersona(java.lang.Object pId)
Version of getPersona() that loads the database if necessary.

Specified by:
getPersona in interface UserAuthority
Overrides:
getPersona in class GenericAccountManager
See Also:
Persona

listAccounts

public java.util.Iterator listAccounts(int pType)
Returns an iterator of accounts with a particular set of types. You may logical-or the account types together to select a union.

Specified by:
listAccounts in interface AccountManager
Overrides:
listAccounts in class GenericAccountManager
Parameters:
pType - The account type(s) to list. You may logical-or the types togeter to select a union.
See Also:
AccountTypes

listMatchingAccounts

public java.util.Iterator listMatchingAccounts(java.lang.String pExpression,
                                               int pType)
Lists accounts that match a given expression.

Specified by:
listMatchingAccounts in interface AccountManager
Overrides:
listMatchingAccounts in class GenericAccountManager
Parameters:
pExpression - The expression to use to determine which accounts to list. Currently the language used for the expression is undefined.
pType - The account type(s) to match against. You may logical-or the types togeter to select a union.
See Also:
AccountTypes

getAccount

public Account getAccount(java.lang.String pAccountName)
Version of getAccount() that loads the database if necessary

Specified by:
getAccount in interface AccountManager
Overrides:
getAccount in class GenericAccountManager
Parameters:
pAccountName - The name of the account to retrieve.

createAccount

public Account createAccount(java.lang.String pAccountName,
                             int pType,
                             java.util.Map pAttributes)
                      throws AccountExistsException,
                             InvalidAttributeException,
                             PermissionDeniedException
Creates a new account with a given set of attributes.

Specified by:
createAccount in interface AccountManager
Overrides:
createAccount in class GenericAccountManager
Parameters:
pAccountName - The name of the account to create.
pAttributes - Set of attributes that should be set in the new account. Usually at least "password" is required. All attribute values must be strings.
pType - The type of the account to create.
Throws:
AccountExistsException
InvalidAttributeException
PermissionDeniedException
See Also:
AccountTypes

removeAccount

public void removeAccount(java.lang.String pAccountName)
                   throws NoSuchAccountException
Removes an account with the indicated name, if possible.

Specified by:
removeAccount in interface AccountManager
Overrides:
removeAccount in class GenericAccountManager
Throws:
NoSuchAccountException

setPersonaeFor

public boolean setPersonaeFor(User pUser,
                              java.lang.String pId)
Populates a user object with the persona information for the given user ID.

Specified by:
setPersonaeFor in interface IdUserAuthority
Overrides:
setPersonaeFor in class GenericAccountManager

login

public boolean login(User pUser,
                     java.lang.String pName,
                     java.lang.String pHashedPassword,
                     java.lang.Object pHashKey)
Authenticates a user, populating the User object with appropriate personae. Note that the password must have been previously hashed using the PasswordHasher returned by getPasswordHasher().

Specified by:
login in interface LoginUserAuthority
Overrides:
login in class GenericAccountManager
See Also:
PasswordHasher