|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface UserDatabase
Defines an interface for loading, persisting and storing users.
Method Summary | |
---|---|
void |
commit()
Persists the current state of the user database to back-end storage. |
void |
deleteByLoginName(String loginName)
Looks up and deletes the first UserProfile in the user database
that matches a profile having a given login name. |
UserProfile |
find(String index)
Looks up and returns the first UserProfile in the user database
that whose login name, full name, or wiki name matches the supplied
string. |
UserProfile |
findByEmail(String index)
Looks up and returns the first UserProfile in the user database
that matches a profile having a given e-mail address. |
UserProfile |
findByFullName(String index)
Looks up and returns the first UserProfile in the user database
that matches a profile having a given full name. |
UserProfile |
findByLoginName(String index)
Looks up and returns the first UserProfile in the user database
that matches a profile having a given login name. |
UserProfile |
findByWikiName(String index)
Looks up and returns the first UserProfile in the user database
that matches a profile having a given wiki name. |
Principal[] |
getPrincipals(String identifier)
Looks up the Principals representing a user from the user database. |
Principal[] |
getWikiNames()
Returns all WikiNames that are stored in the UserDatabase as an array of Principal objects. |
void |
initialize(WikiEngine engine,
Properties props)
Initializes the user database based on values from a Properties object. |
boolean |
isSharedWithContainer()
Returns true if this user database shares user/password data with the
web container; false otherwise. |
UserProfile |
newProfile()
Factory method that instantiates a new user profile. |
void |
save(UserProfile profile)
Saves a UserProfile to the user database, overwriting the
existing profile if it exists. |
boolean |
validatePassword(String loginName,
String password)
Determines whether a supplied user password is valid, given a login name and password. |
Method Detail |
---|
void commit() throws WikiSecurityException
synchronized
.
WikiSecurityException
void deleteByLoginName(String loginName) throws NoSuchPrincipalException, WikiSecurityException
UserProfile
in the user database
that matches a profile having a given login name. If the user database
does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
. The method does not commit the
results of the delete; it only alters the database in memory.
loginName
- the login name of the user profile that shall be deleted
NoSuchPrincipalException
WikiSecurityException
Principal[] getPrincipals(String identifier) throws NoSuchPrincipalException
Looks up the Principals representing a user from the user database. These
are defined as a set of Principals manufactured from the login name, full
name, and wiki name. The order of the Principals returned is not
significant. If the user database does not contain a user with the
supplied identifier, throws a NoSuchPrincipalException
.
Note that if an implememtation wishes to mark one of the returned
Principals as representing the user's common name, it should instantiate
this Principal using
WikiPrincipal.WikiPrincipal(String, String)
with the type
parameter set to
WikiPrincipal.FULL_NAME
. The method
WikiSession.getUserPrincipal()
will return this
principal as the "primary" principal. Note that this method can also be
used to mark a WikiPrincipal as a login name or a wiki name.
identifier
- the name of the user to retrieve; this corresponds to
value returned by the user profile's
UserProfile.getLoginName()
method.
NoSuchPrincipalException
Principal[] getWikiNames() throws WikiSecurityException
WikiSecurityException
UserProfile find(String index) throws NoSuchPrincipalException
UserProfile
in the user database
that whose login name, full name, or wiki name matches the supplied
string. This method provides a "forgiving" search algorithm for resolving
Principal names when the exact profile attribute that supplied the name
is unknown.
index
- the login name, full name, or wiki name
NoSuchPrincipalException
UserProfile findByEmail(String index) throws NoSuchPrincipalException
UserProfile
in the user database
that matches a profile having a given e-mail address. If the user
database does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
.
index
- the e-mail address of the desired user profile
NoSuchPrincipalException
UserProfile findByLoginName(String index) throws NoSuchPrincipalException
UserProfile
in the user database
that matches a profile having a given login name. If the user database
does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
.
index
- the login name of the desired user profile
NoSuchPrincipalException
UserProfile findByWikiName(String index) throws NoSuchPrincipalException
UserProfile
in the user database
that matches a profile having a given wiki name. If the user database
does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
.
index
- the wiki name of the desired user profile
NoSuchPrincipalException
UserProfile findByFullName(String index) throws NoSuchPrincipalException
UserProfile
in the user database
that matches a profile having a given full name. If the user database
does not contain a user with a matching attribute, throws a
NoSuchPrincipalException
.
index
- the fill name of the desired user profile
NoSuchPrincipalException
void initialize(WikiEngine engine, Properties props) throws NoRequiredPropertyException
NoRequiredPropertyException
boolean isSharedWithContainer()
true
if this user database shares user/password data with the
web container; false otherwise.
- Returns:
- the result
UserProfile newProfile()
UserProfile.isNew()
method of profiles created using
this method should return true
.
void save(UserProfile profile) throws WikiSecurityException
Saves a UserProfile
to the user database, overwriting the
existing profile if it exists. The user name under which the profile
should be saved is returned by the supplied profile's
UserProfile.getLoginName()
method.
The database implementation is responsible for detecting potential duplicate user profiles; specifically, the login name, wiki name, and full name must be unique. The implementation is not required to check for validity of passwords or e-mail addresses. Special case: if the profile already exists and the password is null, it should retain its previous value, rather than being set to null.
Implementations are required to time-stamp the creation or modification fields of the UserProfile./p>
Calling classes should generally call
AuthenticationManager.refreshCredentials(WikiSession)
after
calling this method to ensure that Principals are reloaded into the
current WikiSession's Subject.
profile
- the user profile to save
WikiSecurityException
- if the profile cannot be savedboolean validatePassword(String loginName, String password)
loginName
- the login namepassword
- the password
true
if the password is valid, false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |