public class RepositoryApplicationUserAuthority extends GenericUserAuthority implements LoginUserAuthority
This LoginUserAuthority implements the bare minimum required to do logins and determine role memberships. It reads its data from a Repository, and must be configured with the names of the repository views and properties that it should use to obtain information such as login names, passwords, etc. It only reads from the Repository - it never writes.
The Persona objects generated by this UserAuthority represent only users, not groups or privileges. Personas are read only, and have no subPersonas or attributes. The only methods implemented for a Persona are getName (which returns the user's login), getUserAuthority, equals, and hasRole.
The repository is expected to contain a repository view representing the users, from which logins and passwords will be read. Presumably this repository view will contain more information about a user, but the UserAuthority only cares about those particular properties.
Optionally, the user's repository view may contain a "roles" property, which is consulted when Persona.hasRole is called. This property may be one of several types:
The following properties are used to configure all of the above:
| Type | Property and Description |
|---|---|
boolean |
hasRoleViewRoleName
Returns true if RoleViewRoleNameProperty is specified, false
if it is null or empty String
|
boolean |
hasUserViewLogin
Returns true if UserViewLoginProperty is specified, false
if it is null or empty String
|
boolean |
hasUserViewPassword
Returns true if UserViewPasswordProperty is specified, false
if it is null or empty String
|
boolean |
hasUserViewRoles
Returns true if UserViewRolesProperty is specified, false
if it is null or empty String
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_VERSION |
SERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description |
|---|
RepositoryApplicationUserAuthority()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
doStartService()
This is called after a Service has been created, placed into the
naming hierarchy, and initialized with its configured property
values.
|
PasswordHasher |
getAlternateUserPasswordHasher()
Returns the password hasher object used in case the user password hasher is
not present in the user Profile.
|
PasswordHasher |
getPasswordHasher()
Returns the password hasher object used to encrypt password text to
whatever format is required by login().
|
Persona |
getPersona(java.lang.Object pLoginName)
Returns a persona for the given login name.
|
Repository |
getRepository() |
java.lang.String |
getRoleViewRoleNameProperty() |
javax.transaction.TransactionManager |
getTransactionManager() |
java.lang.String |
getUserView() |
java.lang.String |
getUserViewLoginProperty() |
java.lang.String |
getUserViewPasswordProperty() |
java.lang.String |
getUserViewRolesProperty() |
boolean |
hasRole(RepositoryItem pUserItem,
java.lang.String pLoginName,
java.lang.String pRoleName)
Determine if the specified user's item has the specified role
name.
|
boolean |
hasRoleViewRoleNameProperty()
Returns true if RoleViewRoleNameProperty is specified, false
if it is null or empty String
|
boolean |
hasUserView()
Returns true if UserView is specified, false
if it is null or empty String
|
boolean |
hasUserViewLoginProperty()
Returns true if UserViewLoginProperty is specified, false
if it is null or empty String
|
boolean |
hasUserViewPasswordProperty()
Returns true if UserViewPasswordProperty is specified, false
if it is null or empty String
|
boolean |
hasUserViewRolesProperty()
Returns true if UserViewRolesProperty is specified, false
if it is null or empty String
|
boolean |
login(User pUser,
java.lang.String pName,
java.lang.String pPassword,
java.lang.Object pHashKey)
Authenticates a user, populating the User object with appropriate
personae.
|
boolean |
loginWithUserPasswordHasher(User user,
java.lang.String name,
java.lang.String hashedPassword,
java.lang.Object hashKey,
PasswordHasher pHasher)
Authenticates a user using user specific Password Hasher, populating the
User object with appropriate personae.
|
void |
setPasswordHasher(PasswordHasher pPasswordHasher)
Sets the password hasher object used to encrypt password text to
whatever format is required by login().
|
void |
setRepository(Repository pRepository) |
void |
setRoleViewRoleNameProperty(java.lang.String pRoleViewRoleNameProperty) |
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager) |
void |
setUserView(java.lang.String pUserView) |
void |
setUserViewLoginProperty(java.lang.String pUserViewLoginProperty) |
void |
setUserViewPasswordProperty(java.lang.String pUserViewPasswordProperty) |
void |
setUserViewRolesProperty(java.lang.String pUserViewRolesProperty) |
addAuthenticationFailedListener, addAuthenticationSucceededListener, addSpecialPersona, fireAuthenticationFailedEvent, fireAuthenticationSucceededEvent, getProxyUserAuthorities, getSpecialPersonae, getSupportsEveryone, getUserAuthorityName, removeAuthenticationFailedListener, removeAuthenticationSucceededListener, removeSpecialPersona, setProxyUserAuthorities, setSpecialPersonae, setSupportsEveryone, setUserAuthorityName, userDestroyedaddToRegistry, getRegistry, getRegistryName, getServiceName, removeFromRegistry, setRegistryName, setServiceName, startService, stopServiceaddLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfovlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAuthenticationFailedListener, addAuthenticationSucceededListener, getUserAuthorityName, removeAuthenticationFailedListener, removeAuthenticationSucceededListener, userDestroyedpublic RepositoryApplicationUserAuthority()
public Repository getRepository()
public void setRepository(Repository pRepository)
public javax.transaction.TransactionManager getTransactionManager()
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
public java.lang.String getUserView()
public void setUserView(java.lang.String pUserView)
public java.lang.String getUserViewLoginProperty()
public void setUserViewLoginProperty(java.lang.String pUserViewLoginProperty)
public java.lang.String getUserViewPasswordProperty()
public void setUserViewPasswordProperty(java.lang.String pUserViewPasswordProperty)
public java.lang.String getUserViewRolesProperty()
public void setUserViewRolesProperty(java.lang.String pUserViewRolesProperty)
public java.lang.String getRoleViewRoleNameProperty()
public void setRoleViewRoleNameProperty(java.lang.String pRoleViewRoleNameProperty)
public boolean hasRole(RepositoryItem pUserItem, java.lang.String pLoginName, java.lang.String pRoleName)
public boolean hasUserView()
public boolean hasUserViewLoginProperty()
public boolean hasUserViewPasswordProperty()
public boolean hasUserViewRolesProperty()
public boolean hasRoleViewRoleNameProperty()
public Persona getPersona(java.lang.Object pLoginName)
getPersona in interface UserAuthoritygetPersona in class GenericUserAuthoritypublic PasswordHasher getPasswordHasher()
getPasswordHasher in interface LoginUserAuthoritypublic void setPasswordHasher(PasswordHasher pPasswordHasher)
public boolean login(User pUser, java.lang.String pName, java.lang.String pPassword, java.lang.Object pHashKey)
login in interface LoginUserAuthorityPasswordHasherpublic void doStartService()
throws ServiceException
GenericServicedoStartService in class GenericServiceServiceException - if the Service had a problem starting uppublic PasswordHasher getAlternateUserPasswordHasher()
LoginUserAuthoritygetAlternateUserPasswordHasher in interface LoginUserAuthoritypublic boolean loginWithUserPasswordHasher(User user, java.lang.String name, java.lang.String hashedPassword, java.lang.Object hashKey, PasswordHasher pHasher)
LoginUserAuthorityloginWithUserPasswordHasher in interface LoginUserAuthorityPasswordHasher