org.wamblee.security.authorization
Interface AuthorizationService

All Known Implementing Classes:
AbstractAuthorizationService, DefaultAuthorizationService, JpaAuthorizationService

public interface AuthorizationService

Service to determine if access to a certain resource is allowed.

Author:
Erik Brakkee

Method Summary
 void appendRule(AuthorizationRule aRule)
          Appends a new authorization rule to the end.
<T> T
check(T aResource, Operation aOperation)
          Checks if the given operation is allowed on the resource.
 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.
 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.
 

Method Detail

isAllowed

boolean isAllowed(java.lang.Object aResource,
                  Operation aOperation)
Checks whether an operation is allowed on a resource.

Parameters:
aResource - Resource.
aOperation - Operation.
Returns:
Checks whether the operation is allowed on a resource.

check

<T> T check(T aResource,
            Operation aOperation)
Checks if the given operation is allowed on the resource.

Type Parameters:
T - Type of resource
Parameters:
aResource - Resource.
aOperation - Operation.
Returns:
Resource passed in in case access is allowed
Throws:
AuthorizationException - In case access is denied.

getRules

AuthorizationRule[] getRules()
Gets the authorization rules.

Returns:
Rules.

appendRule

void appendRule(AuthorizationRule aRule)
Appends a new authorization rule to the end.

Parameters:
aRule - Rule to append.

removeRule

void removeRule(int aIndex)
Removes a rule.

Parameters:
aIndex - Index of the rule to remove.

insertRuleAfter

void insertRuleAfter(int aIndex,
                     AuthorizationRule aRule)
Inserts a rule.

Parameters:
aIndex - Index of the position of the rule after insertion.
aRule - Rule to insert.

setUserAccessor

void setUserAccessor(UserAccessor aUserAccessor)
Sets the user accessor so that the authorization service can get access to the logged in user.

Parameters:
aUserAccessor - User accessor.

setUserAdministration

void setUserAdministration(UserAdministration aUserAdmin)
Sets the user administration so that the authorization service can check information for the the current user.

Parameters:
aUserAdmin - User administration.


Copyright © 2022. All Rights Reserved.