Package org.mapfish.print.config.access
Class RoleAccessAssertion
java.lang.Object
org.mapfish.print.config.access.RoleAccessAssertion
- All Implemented Interfaces:
AccessAssertion
,ConfigurationObject
An access assertion that verifies that the current user has the required roles.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
assertAccess
(String resourceDescription, Object protectedResource) Checks that the user can access the resource.copy()
Deep copy of this access assertion.boolean
int
hashCode()
org.json.JSONObject
marshal()
Encode the assertion as JSON for later loading.setRequiredRoles
(Collection<String> assertionRequiredRoles) Set the roles required to allow access.void
unmarshal
(org.json.JSONObject encodedAssertion) Load the assertion properties from the JSON data.void
validate
(List<Throwable> validationErrors, Configuration configuration) validate that the configuration was correct.
-
Constructor Details
-
RoleAccessAssertion
public RoleAccessAssertion()
-
-
Method Details
-
setRequiredRoles
Set the roles required to allow access. If not roles then the user must be logged in but does not have to have any particular role.This method may only be called once, any subsequent calls will result in errors.
- Parameters:
assertionRequiredRoles
- the roles required to access the protected resource
-
assertAccess
Description copied from interface:AccessAssertion
Checks that the user can access the resource.Will throw
AuthenticationCredentialsNotFoundException
if the user has not logged in or supplied credentials.Will throw
AccessDeniedException
if the user is logged in but may not access the resource.- Specified by:
assertAccess
in interfaceAccessAssertion
- Parameters:
resourceDescription
- a string describing the resource for logging and exception throwing purposesprotectedResource
- the resource being protected.
-
marshal
public org.json.JSONObject marshal()Description copied from interface:AccessAssertion
Encode the assertion as JSON for later loading. Each call should return a unique JSON object.- Specified by:
marshal
in interfaceAccessAssertion
-
unmarshal
public void unmarshal(org.json.JSONObject encodedAssertion) Description copied from interface:AccessAssertion
Load the assertion properties from the JSON data.- Specified by:
unmarshal
in interfaceAccessAssertion
- Parameters:
encodedAssertion
- the assertion encoded as JSON.
-
validate
Description copied from interface:ConfigurationObject
validate that the configuration was correct.- Specified by:
validate
in interfaceConfigurationObject
- Parameters:
validationErrors
- a list to add any detected errors to.configuration
- the containing configuration
-
equals
-
hashCode
public int hashCode() -
copy
Description copied from interface:AccessAssertion
Deep copy of this access assertion.- Specified by:
copy
in interfaceAccessAssertion
- Returns:
- the copy
-