|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ecyrd.jspwiki.auth.UserManager
public class UserManager
Provides a facade for user and group information.
Nested Class Summary | |
---|---|
class |
UserManager.DummyGroupManager
Implements a simple GroupManager which does not simply manage any groups. |
class |
UserManager.DummyUserDatabase
This is a database that gets used if nothing else is available. |
Constructor Summary | |
---|---|
UserManager()
Constructs a new UserManager instance. |
Method Summary | |
---|---|
GroupManager |
getGroupManager()
Returns the GroupManager employed by this WikiEngine. |
UserDatabase |
getUserDatabase()
Returns the UserDatabase employed by this WikiEngine. |
UserProfile |
getUserProfile(WikiSession session)
Retrieves the UserProfile for the
user in a wiki session. |
void |
initialize(WikiEngine engine,
Properties props)
Initializes the engine for its nefarious purposes. |
UserProfile |
parseProfile(WikiContext context)
Extracts user profile parameters from the HTTP request and populates a UserProfile with them. |
void |
setUserProfile(WikiSession session,
UserProfile profile)
Saves the UserProfile for the user in
a wiki session. |
void |
validateProfile(WikiContext context,
UserProfile profile)
Validates a user profile, and appends any errors to the session errors list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UserManager()
Method Detail |
---|
public void initialize(WikiEngine engine, Properties props)
engine
- the current wiki engineprops
- the wiki engine initialization propertiespublic GroupManager getGroupManager()
public UserDatabase getUserDatabase()
public UserProfile getUserProfile(WikiSession session)
UserProfile
for the
user in a wiki session. If the user is authenticated, the UserProfile
returned will be the one stored in the user database; if one does not
exist, a new one will be initialized and returned. If the user is
anonymous or asserted, the UserProfile will always be newly
initialized to prevent spoofing of identities. If a UserProfile needs to
be initialized, its
UserProfile.isNew()
method will
return true
, and its login name will will be set
automatically if the user is authenticated. Note that this method does
not modify the retrieved (or newly created) profile otherwise; other
fields in the user profile may be null
.
session
- the wiki session, which may not be null
WikiSecurityException
- if the database returns an exception
IllegalStateException
- if a new UserProfile was created, but its
UserProfile.isNew()
method returns
false
. This is meant as a quality check for UserDatabase
providers; it should only be thrown if the implementation is faulty.public void setUserProfile(WikiSession session, UserProfile profile) throws WikiSecurityException, DuplicateUserException
UserProfile
for the user in
a wiki session. This method verifies that a user profile to be saved
doesn't collide with existing profiles; that is, the login name, wiki
name or full name is already used by another profile. If the profile
collides, a DuplicateUserException
is thrown. After saving
the profile, the user database changes are committed, and the user's
credential set is refreshed; if custom authentication is used, this means
the user will be automatically be logged in.
session
- the wiki session, which may not be null
profile
- the user profile, which may not be null
WikiSecurityException
DuplicateUserException
public UserProfile parseProfile(WikiContext context)
Extracts user profile parameters from the HTTP request and populates a UserProfile with them. The UserProfile will either be a copy of the user's existing profile (if one can be found), or a new profile (if not). The rules for populating the profile as as follows:
email
or password
parameter values differ
from those in the existing profile, the passed parameters override the
old values.fullname
and wikiname
parameters are always
used; for existing profiles the existing values are used, and whatever
values the user supplied are discarded.WikiSession.getLoginPrincipal()
. Otherwise,
the value of the loginname
parameter is used.
context
- the current wiki context
public void validateProfile(WikiContext context, UserProfile profile)
WikiSession.getMessages()
.
context
- the current wiki contextprofile
- the supplied UserProfile
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |