|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.turbine.services.BaseInitable | +--org.apache.turbine.services.BaseService | +--org.apache.turbine.services.TurbineBaseService | +--org.apache.turbine.services.security.BaseSecurityService
This is a common subset of SecurityService implementation. Provided functionality includes:
Fields inherited from class org.apache.turbine.services.BaseService |
configuration, name, properties, serviceBroker |
Fields inherited from class org.apache.turbine.services.BaseInitable |
initableBroker, isInitialized |
Fields inherited from interface org.apache.turbine.services.security.SecurityService |
SECURE_PASSWORDS_ALGORITHM_DEFAULT, SECURE_PASSWORDS_ALGORITHM_KEY, SECURE_PASSWORDS_DEFAULT, SECURE_PASSWORDS_KEY, SERVICE_NAME, USER_CLASS_DEFAULT, USER_CLASS_KEY, USER_MANAGER_DEFAULT, USER_MANAGER_KEY |
Constructor Summary | |
BaseSecurityService()
|
Method Summary | |
boolean |
accountExists(java.lang.String username)
Check whether a specified user's account exists. |
boolean |
accountExists(User user)
Check whether a specified user's account exists. |
void |
addUser(User user,
java.lang.String password)
Creates new user account with specified attributes. |
void |
changePassword(User user,
java.lang.String oldPassword,
java.lang.String newPassword)
Change the password for an User. |
java.lang.String |
encryptPassword(java.lang.String password)
This method provides client-side encryption of passwords. |
void |
forcePassword(User user,
java.lang.String password)
Forcibly sets new password for an User. |
GroupSet |
getAllGroups()
Retrieves all groups defined in the system. |
PermissionSet |
getAllPermissions()
Retrieves all permissions defined in the system. |
RoleSet |
getAllRoles()
Retrieves all roles defined in the system. |
User |
getAnonymousUser()
Constructs an User object to represent an anonymous user of the application. |
User |
getAuthenticatedUser(java.lang.String username,
java.lang.String password)
Authenticates an user, and constructs an User object to represent him/her. |
Group |
getGlobalGroup()
Provides a reference to the Group object that represents the global group. |
Group |
getGroup(java.lang.String name)
Retrieve a Group object with specified name. |
Permission |
getPermission(java.lang.String name)
Retrieve a Permission object with specified name. |
Role |
getRole(java.lang.String name)
Retrieve a Role object with specified name. |
User |
getUser(java.lang.String username)
Constructs an User object to represent a registered user of the application. |
java.lang.Class |
getUserClass()
Return a Class object representing the system's chosen implementation of of User interface. |
User |
getUserInstance()
Construct a blank User object. |
User[] |
getUsers(org.apache.torque.util.Criteria criteria)
Retrieve a set of users that meet the specified criteria. |
void |
init(javax.servlet.ServletConfig config)
Initializes the SecurityService, locating the apropriate UserManager |
protected void |
lockExclusive()
Acquire an exclusive lock on the security information repository. |
protected void |
lockShared()
Acquire a shared lock on the security information repository. |
void |
removeUser(User user)
Removes an user account from the system. |
void |
saveUser(User user)
Saves User's data in the permanent storage. |
protected void |
unlockExclusive()
Release an exclusive lock on the security information repository. |
protected void |
unlockShared()
Release a shared lock on the security information repository. |
Methods inherited from class org.apache.turbine.services.TurbineBaseService |
init, init, init, shutdown |
Methods inherited from class org.apache.turbine.services.BaseService |
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker |
Methods inherited from class org.apache.turbine.services.BaseInitable |
getInit, getInitableBroker, setInit, setInitableBroker |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.turbine.services.security.SecurityService |
addGroup, addPermission, addRole, getACL, getGroups, getNewGroup, getNewPermission, getNewRole, getPermissions, getPermissions, getRoles, grant, grant, removeGroup, removePermission, removeRole, renameGroup, renamePermission, renameRole, revoke, revoke, revokeAll, revokeAll, saveGroup, savePermission, saveRole |
Methods inherited from interface org.apache.turbine.services.Service |
getConfiguration, getName, getProperties, setName, setServiceBroker |
Methods inherited from interface org.apache.turbine.services.Initable |
getInit, init, init, setInitableBroker, shutdown |
Constructor Detail |
public BaseSecurityService()
Method Detail |
public java.lang.String encryptPassword(java.lang.String password)
secure.passwords
are enabled in TurbineResources,
the password will be encrypted, if not, it will be returned unchanged.
The secure.passwords.algorithm
property can be used
to chose which digest algorithm should be used for performing the
encryption. SHA
is used by default.encryptPassword
in interface SecurityService
password
- the password to processpublic void init(javax.servlet.ServletConfig config) throws InitializationException
init
in class TurbineBaseService
config
- a ServletConfig, to enforce early initializationpublic java.lang.Class getUserClass() throws UnknownEntityException
getUserClass
in interface SecurityService
UnknownEntityException
- if the implementation of User interface
could not be determined, or does not exist.public User getUserInstance() throws UnknownEntityException
getUserInstance
in interface SecurityService
UnknownEntityException
- if the object could not be instantiated.public boolean accountExists(User user) throws DataBackendException
accountExists
in interface SecurityService
user
- The user to be checked.DataBackendException
- if there was an error accessing the data backend.public boolean accountExists(java.lang.String username) throws DataBackendException
accountExists
in interface SecurityService
usename
- The name of the user to be checked.DataBackendException
- if there was an error accessing the data backend.public User getAuthenticatedUser(java.lang.String username, java.lang.String password) throws DataBackendException, UnknownEntityException, PasswordMismatchException
getAuthenticatedUser
in interface SecurityService
username
- The user name.password
- The user password.PasswordMismatchException
- if the supplied password was
incorrect.UnknownEntityException
- if the user's account does not
exist in the database.DataBackendException
- if there is a problem accessing the
storage.public User getUser(java.lang.String username) throws DataBackendException, UnknownEntityException
getUser
in interface SecurityService
username
- The user name.UnknownEntityException
- if the user's account does not
exist in the database.DataBackendException
- if there is a problem accessing the
storage.public User[] getUsers(org.apache.torque.util.Criteria criteria) throws DataBackendException
User
interface, plus the names
of the custom attributes you added to your user representation
in the data storage. Use verbatim names of the attributes -
without table name prefix in case of DB implementation.getUsers
in interface SecurityService
criteria
- The criteria of selection.DataBackendException
- if there is a problem accessing the
storage.public User getAnonymousUser() throws UnknownEntityException
getAnonymousUser
in interface SecurityService
UnknownEntityException
- if the implementation of User interface
could not be determined, or does not exist.public void saveUser(User user) throws UnknownEntityException, DataBackendException
saveUser
in interface SecurityService
UnknownEntityException
- if the user's account does not
exist in the database.DataBackendException
- if there is a problem accessing the
storage.public void addUser(User user, java.lang.String password) throws DataBackendException, EntityExistsException
addUser
in interface SecurityService
user
- the object describing account to be created.DataBackendException
- if there was an error accessing the data backend.EntityExistsException
- if the user account already exists.public void removeUser(User user) throws DataBackendException, UnknownEntityException
removeUser
in interface SecurityService
user
- the object describing the account to be removed.DataBackendException
- if there was an error accessing the data backend.UnknownEntityException
- if the user account is not present.public void changePassword(User user, java.lang.String oldPassword, java.lang.String newPassword) throws PasswordMismatchException, UnknownEntityException, DataBackendException
changePassword
in interface SecurityService
user
- an User to change password for.oldPassword
- the current password supplied by the user.newPassword
- the current password requested by the user.PasswordMismatchException
- if the supplied password was
incorrect.UnknownEntityException
- if the user's record does not
exist in the database.DataBackendException
- if there is a problem accessing the
storage.public void forcePassword(User user, java.lang.String password) throws UnknownEntityException, DataBackendException
forcePassword
in interface SecurityService
user
- an User to change password for.password
- the new password.UnknownEntityException
- if the user's record does not
exist in the database.DataBackendException
- if there is a problem accessing the
storage.protected void lockShared()
protected void unlockShared()
protected void lockExclusive()
synchronized
themselves!protected void unlockExclusive()
synchronized
!public Group getGlobalGroup()
getGlobalGroup
in interface SecurityService
public Group getGroup(java.lang.String name) throws DataBackendException, UnknownEntityException
getGroup
in interface SecurityService
name
- the name of the Group.public Role getRole(java.lang.String name) throws DataBackendException, UnknownEntityException
getRole
in interface SecurityService
name
- the name of the Role.public Permission getPermission(java.lang.String name) throws DataBackendException, UnknownEntityException
getPermission
in interface SecurityService
name
- the name of the Permission.public GroupSet getAllGroups() throws DataBackendException
getAllGroups
in interface SecurityService
DataBackendException
- if there was an error accessing the data backend.public RoleSet getAllRoles() throws DataBackendException
getAllRoles
in interface SecurityService
DataBackendException
- if there was an error accessing the data backend.public PermissionSet getAllPermissions() throws DataBackendException
getAllPermissions
in interface SecurityService
DataBackendException
- if there was an error accessing the data backend.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |