|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.org.ogsadai.examples.authorization.SimpleFileAuthorizer
uk.org.ogsadai.examples.authorization.UpdateableFileAuthorizer
A simple access authorizer which can be updated by adding or removing users in the access control lists.
Field Summary | |
private java.lang.String |
configPath
|
Fields inherited from class uk.org.ogsadai.examples.authorization.SimpleFileAuthorizer |
activityAuthorization, resourceAuthorization |
Constructor Summary | |
UpdateableFileAuthorizer(java.lang.String config)
Constructor. |
Method Summary | |
boolean |
authorizeActivity(java.lang.String resourceID,
Activity activity,
SecurityContext context)
Authorizes access to an activity based on an access control list. |
boolean |
authorizeResource(java.lang.String resourceID,
SecurityContext context)
Authorizes access to a resource based on an access control list. |
void |
grantActivityAccessToUser(java.lang.String activityName,
java.lang.String resourceID,
java.lang.String userDN)
Adds a new user to an activity access control list and rewrites the configuration file. |
void |
grantResourceAccessToUser(java.lang.String resourceID,
java.lang.String userDN)
Adds a new user to the access control list for the given resource and rewrites the configuration file. |
boolean |
removeUserFromActivityAccess(java.lang.String activityName,
java.lang.String resourceID,
java.lang.String userDN)
Removes the given user from the activity access list and rewrites the configuration file. |
boolean |
removeUserFromResourceAccess(java.lang.String resourceID,
java.lang.String userDN)
Removes the given user from the resource access list and rewrites the configuration file. |
private void |
writeConfiguration()
Rewrites the configuration file. |
private void |
writeUsers(java.lang.StringBuffer xml,
java.util.Map map,
java.lang.String element,
java.lang.String attr)
Writes the distinguished names of authorized users wrapped in the given element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final java.lang.String configPath
Constructor Detail |
public UpdateableFileAuthorizer(java.lang.String config) throws java.lang.Exception
config
- path of the configuration file
java.lang.Exception
- if a problem occursMethod Detail |
public boolean authorizeResource(java.lang.String resourceID, SecurityContext context)
SimpleFileAuthorizer
authorizeResource
in interface AccessAuthorizer
authorizeResource
in class SimpleFileAuthorizer
public boolean authorizeActivity(java.lang.String resourceID, Activity activity, SecurityContext context)
SimpleFileAuthorizer
authorizeActivity
in interface AccessAuthorizer
authorizeActivity
in class SimpleFileAuthorizer
public void grantResourceAccessToUser(java.lang.String resourceID, java.lang.String userDN) throws java.lang.Exception
resourceID
- resource identifieruserDN
- distinguished name of the user
java.lang.Exception
- if an error occurred writing the configuration filepublic void grantActivityAccessToUser(java.lang.String activityName, java.lang.String resourceID, java.lang.String userDN) throws java.lang.Exception
activityName
- name of the activityresourceID
- resource identifieruserDN
- distinguished name of the user to be added
java.lang.Exception
- if an error occurred writing the configuration filepublic boolean removeUserFromResourceAccess(java.lang.String resourceID, java.lang.String userDN) throws java.lang.Exception
resourceID
- resouce identifieruserDN
- distinguished name of the user to be removed
true
if the user name was contained in the access
control list
java.lang.Exception
- if a problem occurs when writing the configuration filepublic boolean removeUserFromActivityAccess(java.lang.String activityName, java.lang.String resourceID, java.lang.String userDN) throws java.lang.Exception
activityName
- name of the activityresourceID
- resource identifieruserDN
- distinguished name of the user to be removed
true
if the user name was contained in the access
control list
java.lang.Exception
- if a problem occurs when writing the configuration fileprivate void writeConfiguration() throws java.lang.Exception
java.lang.Exception
- if an error occurred writing the configuration fileprivate void writeUsers(java.lang.StringBuffer xml, java.util.Map map, java.lang.String element, java.lang.String attr)
xml
- buffer to write tomap
- Mapping of a resource/activity name to the set of authorized
userselement
- name of the elementattr
- attribute name
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |