|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wamblee.persistence.AbstractPersistent
org.wamblee.security.authorization.DefaultAuthorizationService
public class DefaultAuthorizationService
Default implementation of an authorization service. To determine whether access to a resource is allowed, the service consults a number of authorization rules in a fixed order. The first rule that gives a result GRANTED or DENIED determines the result of the evaluation. Rules that return any other result are ignoed. If none of the rules match, than access is denied.
| Constructor Summary | |
|---|---|
DefaultAuthorizationService()
Constructs the authorization service. |
|
DefaultAuthorizationService(UserAccessor aAccessor,
java.lang.String aName)
Constructs the service. |
|
| Method Summary | ||
|---|---|---|
void |
appendRule(AuthorizationRule aRule)
Appends a new authorization rule to the end. |
|
|
check(T aResource,
Operation aOperation)
Same as AuthorizationService.isAllowed(Object, Operation) but throws a
RuntimeException in case access is not allowed. |
|
protected java.util.List<AuthorizationRule> |
getMappedRules()
For OR mapping. |
|
protected java.lang.String |
getName()
|
|
AuthorizationRule[] |
getRules()
Gets the authorization rules. |
|
void |
insertRuleAfter(int aIndex,
AuthorizationRule aRule)
Inserts a rule. |
|
boolean |
isAllowed(java.lang.Object aResource,
Operation aOperation)
Checks whether an operation is allowed on a resource. |
|
void |
removeRule(int aIndex)
Removes a rule. |
|
protected void |
setMappedRules(java.util.List<AuthorizationRule> aRules)
For OR mapping. |
|
void |
setName(java.lang.String aName)
|
|
void |
setUserAccessor(UserAccessor aUserAccessor)
Sets the user accessor. |
|
| Methods inherited from class org.wamblee.persistence.AbstractPersistent |
|---|
getPersistedVersion, getPrimaryKey, setPersistedVersion, setPrimaryKey |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.wamblee.persistence.Persistent |
|---|
getPersistedVersion, getPrimaryKey, setPersistedVersion, setPrimaryKey |
| Constructor Detail |
|---|
public DefaultAuthorizationService(UserAccessor aAccessor,
java.lang.String aName)
aAccessor - User accessor.aName - Name of this instance of the service.public DefaultAuthorizationService()
| Method Detail |
|---|
public void setUserAccessor(UserAccessor aUserAccessor)
aUserAccessor - User accessor.
public boolean isAllowed(java.lang.Object aResource,
Operation aOperation)
AuthorizationService
isAllowed in interface AuthorizationServiceaResource - Resource.aOperation - Operation.
public <T> T check(T aResource,
Operation aOperation)
AuthorizationServiceAuthorizationService.isAllowed(Object, Operation) but throws a
RuntimeException in case access is not allowed.
check in interface AuthorizationServiceaResource - Resource to check.aOperation - Operation to perform.
protected java.lang.String getName()
public void setName(java.lang.String aName)
public AuthorizationRule[] getRules()
AuthorizationService
getRules in interface AuthorizationServicepublic void appendRule(AuthorizationRule aRule)
AuthorizationService
appendRule in interface AuthorizationServiceaRule - Rule to append.
public void insertRuleAfter(int aIndex,
AuthorizationRule aRule)
AuthorizationService
insertRuleAfter in interface AuthorizationServiceaIndex - Index of the position of the rule after insertion.aRule - Rule to insert.public void removeRule(int aIndex)
AuthorizationService
removeRule in interface AuthorizationServiceprotected java.util.List<AuthorizationRule> getMappedRules()
protected void setMappedRules(java.util.List<AuthorizationRule> aRules)
aRules - The rules.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||