public final class RoleAccessAssertion extends java.lang.Object implements AccessAssertion
| Constructor and Description |
|---|
RoleAccessAssertion() |
| Modifier and Type | Method and 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.
|
AccessAssertion |
setRequiredRoles(java.util.Collection<java.lang.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(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
validate that the configuration was correct.
|
public AccessAssertion setRequiredRoles(java.util.Collection<java.lang.String> assertionRequiredRoles)
This method may only be called once, any subsequent calls will result in errors.
assertionRequiredRoles - the roles required to access the protected resourcepublic void assertAccess(java.lang.String resourceDescription,
java.lang.Object protectedResource)
AccessAssertionAuthenticationCredentialsNotFoundException 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.assertAccess in interface AccessAssertionresourceDescription - a string describing the resource for logging and exception throwing purposesprotectedResource - the resource being protected.public org.json.JSONObject marshal()
AccessAssertionmarshal in interface AccessAssertionpublic void unmarshal(org.json.JSONObject encodedAssertion)
AccessAssertionunmarshal in interface AccessAssertionencodedAssertion - the assertion encoded as JSON.public void validate(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
ConfigurationObjectvalidate in interface ConfigurationObjectvalidationErrors - a list to add any detected errors to.configuration - the containing configurationpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic AccessAssertion copy()
AccessAssertioncopy in interface AccessAssertion