|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.wamblee.security.authorization.AbstractAuthorizationService
org.wamblee.security.authorization.DefaultAuthorizationService
@Entity 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.
Field Summary |
---|
Fields inherited from class org.wamblee.security.authorization.AbstractAuthorizationService |
---|
NAME_PARAM, QUERY_FIND_BY_NAME |
Constructor Summary | |
---|---|
DefaultAuthorizationService()
Constructs the authorization service. |
|
DefaultAuthorizationService(UserAccessor aAccessor,
UserAdministration aUserAdmin,
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)
Checks if the given operation is allowed on the resource. |
|
protected java.util.List<AuthorizationRule> |
getMappedRules()
For OR mapping. |
|
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 |
setUserAccessor(UserAccessor aUserAccessor)
Sets the user accessor so that the authorization service can get access to the logged in user. |
|
void |
setUserAdministration(UserAdministration aUserAdmin)
Sets the user administration so that the authorization service can check information for the the current user. |
Methods inherited from class org.wamblee.security.authorization.AbstractAuthorizationService |
---|
getName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultAuthorizationService(UserAccessor aAccessor, UserAdministration aUserAdmin, java.lang.String aName)
aAccessor
- User accessor.aUserAdmin
- User administration.aName
- Name of this instance of the service.public DefaultAuthorizationService()
Method Detail |
---|
public void setUserAccessor(UserAccessor aUserAccessor)
AuthorizationService
aUserAccessor
- User accessor.public void setUserAdministration(UserAdministration aUserAdmin)
AuthorizationService
aUserAdmin
- User administration.public boolean isAllowed(java.lang.Object aResource, Operation aOperation)
AuthorizationService
aResource
- Resource.aOperation
- Operation.
public <T> T check(T aResource, Operation aOperation)
AuthorizationService
T
- Type of resourceaResource
- Resource.aOperation
- Operation.
public AuthorizationRule[] getRules()
AuthorizationService
public void appendRule(AuthorizationRule aRule)
AuthorizationService
aRule
- Rule to append.public void insertRuleAfter(int aIndex, AuthorizationRule aRule)
AuthorizationService
aIndex
- Index of the position of the rule after insertion.aRule
- Rule to insert.public void removeRule(int aIndex)
AuthorizationService
aIndex
- Index of the rule to remove.protected 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 |