Package org.mapfish.print.config.access
Class AndAccessAssertion
- java.lang.Object
-
- org.mapfish.print.config.access.AndAccessAssertion
-
- All Implemented Interfaces:
AccessAssertion
,ConfigurationObject
public final class AndAccessAssertion extends java.lang.Object implements AccessAssertion
An access assertion that throws fails if any of the encapsulated assertions fail.
-
-
Constructor Summary
Constructors Constructor Description AndAccessAssertion()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertAccess(java.lang.String resourceDescription, java.lang.Object protectedResource)
Checks that the user can access the resource.AccessAssertion
copy()
Deep copy of this access assertion.boolean
equals(java.lang.Object o)
int
hashCode()
org.json.JSONObject
marshal()
Encode the assertion as JSON for later loading.void
setPredicates(AccessAssertion... predicates)
Set all the Predicates/AccessAssertion that have to all pass in order for this assertion to pass.void
unmarshal(org.json.JSONObject encodedAssertion)
Load the assertion properties from the JSON data.void
validate(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
validate that the configuration was correct.
-
-
-
Method Detail
-
setPredicates
public void setPredicates(@Nonnull AccessAssertion... predicates)
Set all the Predicates/AccessAssertion that have to all pass in order for this assertion to pass.An exception is thrown if this method is called more than once.
- Parameters:
predicates
- the Predicates/AccessAssertion
-
assertAccess
public void assertAccess(java.lang.String resourceDescription, java.lang.Object protectedResource)
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
public void validate(java.util.List<java.lang.Throwable> validationErrors, Configuration configuration)
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
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
copy
public AccessAssertion copy()
Description copied from interface:AccessAssertion
Deep copy of this access assertion.- Specified by:
copy
in interfaceAccessAssertion
- Returns:
- the copy
-
-