com.ecyrd.jspwiki.auth
Class UserManager.DummyGroupManager

java.lang.Object
  extended by com.ecyrd.jspwiki.auth.UserManager.DummyGroupManager
All Implemented Interfaces:
GroupManager, Authorizer
Enclosing class:
UserManager

public class UserManager.DummyGroupManager
extends Object
implements GroupManager

Implements a simple GroupManager which does not simply manage any groups. This is used when jspwiki security is turned off.

Author:
jalkanen

Field Summary
 
Fields inherited from interface com.ecyrd.jspwiki.auth.authorize.GroupManager
PROP_GROUPMANAGER
 
Constructor Summary
UserManager.DummyGroupManager()
           
 
Method Summary
 void add(Group group)
          Adds a Group to the group cache.
 void addWikiEventListener(WikiEventListener listener)
          Registers a WikiEventListener with this GroupManager.
 void commit()
          Commits the groups to persistent storage.
 boolean exists(Group group)
          Returns true if a Group is known to the GroupManager (contained in the group cache), false otherwise.
 Principal findRole(String role)
          Looks up and returns a role Principal matching a given String.
 Principal[] getRoles()
          Returns an array of role Principals this Authorizer knows about.
 void initialize(WikiEngine engine, Properties props)
          Initializes the authorizer.
 boolean isUserInRole(WikiSession session, Principal role)
          Determines whether the Subject associated with a WikiSession is in a particular role.
 void reload()
          Reloads the group cache from persistent storage.
 void remove(Group group)
          Removes a Group from the group cache.
 void removeWikiEventListener(WikiEventListener listener)
          Un-registers a WikiEventListener with this GroupManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserManager.DummyGroupManager

public UserManager.DummyGroupManager()
Method Detail

add

public void add(Group group)
Description copied from interface: GroupManager
Adds a Group to the group cache. Note that this method fail, and will throw an IllegalArgumentException, if the proposed group is the same name as one of the built-in Roles: e.g., Admin, Authenticated, etc. When a Group is added successfully, the GroupManager implementation should send a WikiSecurityEvent of type WikiSecurityEvent.GROUP_ADD to all of its registered WikiEventListeners. It should also register itself as a WikiEventListener for the Group itself, so that additions to the group can be detected and forwarded on to the GroupManager's own listeners.

Specified by:
add in interface GroupManager
Parameters:
group - the Group to add

addWikiEventListener

public void addWikiEventListener(WikiEventListener listener)
Description copied from interface: GroupManager
Registers a WikiEventListener with this GroupManager.

Specified by:
addWikiEventListener in interface GroupManager
Parameters:
listener - the event listener

commit

public void commit()
Description copied from interface: GroupManager
Commits the groups to persistent storage.

Specified by:
commit in interface GroupManager

exists

public boolean exists(Group group)
Description copied from interface: GroupManager
Returns true if a Group is known to the GroupManager (contained in the group cache), false otherwise.

Specified by:
exists in interface GroupManager

initialize

public void initialize(WikiEngine engine,
                       Properties props)
Description copied from interface: Authorizer
Initializes the authorizer.

Specified by:
initialize in interface GroupManager
Specified by:
initialize in interface Authorizer
Parameters:
engine - the current wiki engine
props - the wiki engine initialization properties

reload

public void reload()
Description copied from interface: GroupManager
Reloads the group cache from persistent storage. If this requires all groups in the cache to be flushed, the implementing class should send a WikiSecurityEvent of type WikiSecurityEvent.GROUP_CLEAR_GROUPS to all of its registered WikiEventListeners.

Specified by:
reload in interface GroupManager

remove

public void remove(Group group)
Description copied from interface: GroupManager
Removes a Group from the group cache. When a Group is removed successfully, the GroupManager implementation should send a WikiSecurityEvent of type WikiSecurityEvent.GROUP_REMOVE to all of its registered WikiEventListeners.

Specified by:
remove in interface GroupManager
Parameters:
group - the group to remove

removeWikiEventListener

public void removeWikiEventListener(WikiEventListener listener)
Description copied from interface: GroupManager
Un-registers a WikiEventListener with this GroupManager.

Specified by:
removeWikiEventListener in interface GroupManager
Parameters:
listener - the event listener

findRole

public Principal findRole(String role)
Description copied from interface: Authorizer
Looks up and returns a role Principal matching a given String. If a matching role cannot be found, this method returns null. Note that it may not always be feasible for an Authorizer implementation to return a role Principal.

Specified by:
findRole in interface Authorizer
Parameters:
role - the name of the role to retrieve
Returns:
the role Principal

getRoles

public Principal[] getRoles()
Description copied from interface: Authorizer
Returns an array of role Principals this Authorizer knows about. This method will always return an array; an implementing class may choose to return an zero-length array if it has no ability to identify the roles under its control.

Specified by:
getRoles in interface Authorizer
Returns:
an array of Principals representing the roles

isUserInRole

public boolean isUserInRole(WikiSession session,
                            Principal role)
Description copied from interface: Authorizer
Determines whether the Subject associated with a WikiSession is in a particular role. This method takes two parameters: the WikiSession containing the subject and the desired role ( which may be a Role or a Group). If either parameter is null, this method must return false.

Specified by:
isUserInRole in interface Authorizer
Parameters:
session - the current WikiSession
role - the role to check
Returns:
true if the user is considered to be in the role, false otherwise