Package digilib.auth
Class AuthzOpsImpl
java.lang.Object
digilib.auth.AuthzOpsImpl
- All Implemented Interfaces:
AuthzOps
- Direct Known Subclasses:
MetaAccessAuthzOps
,PathAuthzOps
Basic implementation of AuthOps interface.
Provides basic implementations. Only rolesForPath needs to be implemented by
specific implementations.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
init
(DigilibConfiguration dlConfig) Configure this AuthzOps instance.boolean
isAuthorizationRequired
(DigilibRequest request) Test if the request must be authorized to access the filepath.boolean
isAuthorized
(DigilibRequest request) Test if the request is authorized to access filepath.boolean
isRoleAuthorized
(List<String> rolesRequired, DigilibServletRequest request) Test request authorization against a list of roles.rolesForPath
(DigilibServletRequest request) Authorization roles needed for request.
-
Field Details
-
logger
protected static final org.slf4j.Logger loggergeneral logger for this class -
authnOps
authentication instance
-
-
Constructor Details
-
AuthzOpsImpl
public AuthzOpsImpl()
-
-
Method Details
-
init
Description copied from interface:AuthzOps
Configure this AuthzOps instance.- Specified by:
init
in interfaceAuthzOps
- Parameters:
dlConfig
- current DigilibConfiguration- Throws:
AuthOpException
- Exception thrown on error
-
isAuthorizationRequired
Description copied from interface:AuthzOps
Test if the request must be authorized to access the filepath. Information about the user is taken from the DigilibRequest.- Specified by:
isAuthorizationRequired
in interfaceAuthzOps
- Parameters:
request
- DigilibRequest with user information.- Returns:
- true if the user request must be authorized.
- Throws:
AuthOpException
- Exception thrown on error.- See Also:
-
isAuthorized
Description copied from interface:AuthzOps
Test if the request is authorized to access filepath.- Specified by:
isAuthorized
in interfaceAuthzOps
- Parameters:
request
- Request with user information.- Returns:
- true if the request is allowed.
- Throws:
AuthOpException
- Exception thrown on error.- See Also:
-
isRoleAuthorized
public boolean isRoleAuthorized(List<String> rolesRequired, DigilibServletRequest request) throws AuthOpException Test request authorization against a list of roles.- Parameters:
rolesRequired
- List of Strings with role names.request
- ServletRequest with address information.- Returns:
- true if the user information in the request authorizes one of the roles.
- Throws:
AuthOpException
- Exception thrown on error.
-
rolesForPath
Authorization roles needed for request. Returns the list of authorization roles that are needed to access the specified path. No list means the path is free. The location information of the request is also considered.- Parameters:
request
- DigilibRequest with address information.- Returns:
- List of Strings with role names.
- Throws:
AuthOpException
- Exception thrown on error.
-