com.ecyrd.jspwiki.auth
Interface Authorizer

All Known Subinterfaces:
GroupManager
All Known Implementing Classes:
DefaultGroupManager, UserManager.DummyGroupManager, WebContainerAuthorizer

public interface Authorizer

Interface for service providers of authorization information.

Since:
2.3
Version:
$Revision: 1.5 $ $Date: 2005/09/02 23:52:48 $
Author:
Andrew Jaquith

Method Summary
 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.
 

Method Detail

getRoles

Principal[] getRoles()
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.

Returns:
an array of Principals representing the roles

findRole

Principal findRole(String role)
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.

Parameters:
role - the name of the role to retrieve
Returns:
the role Principal

initialize

void initialize(WikiEngine engine,
                Properties props)
Initializes the authorizer.

Parameters:
engine - the current wiki engine
props - the wiki engine initialization properties

isUserInRole

boolean isUserInRole(WikiSession session,
                     Principal role)
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.

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