@Contract public interface AuthorizationService extends SecurityService
AuthorizationService interface provides methods that allow server and container
to determine whether access should be allowed to a particular resource. It is intended for
internal use, not for use by applications.| Modifier and Type | Interface and Description |
|---|---|
static interface |
AuthorizationService.PolicyDeploymentContext
This interface represents a PolicyDeploymentContext as returned by the Authorization
Service's findOrCreateDeploymentContext() method.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
appendAttributeResolver(AzAttributeResolver resolver)
Appends the given
instance to the internal ordered list of AzAttributeResolver instances,
if not currently in the list based on
. |
AuthorizationService.PolicyDeploymentContext |
findOrCreateDeploymentContext(String appContext)
Finds an existing PolicyDeploymentContext, or create a new one if one does not
already exist for the specified appContext.
|
List<AzAttributeResolver> |
getAttributeResolvers()
Determines the current list of
AttributeResolver instances,
in execution order. |
AzResult |
getAuthorizationDecision(AzSubject subject,
AzResource resource,
AzAction action)
The primary authorization method.
|
boolean |
isAuthorized(Subject subject,
URI resource)
Determines whether the given Subject is authorized to access the given resource,
specified by a URI.
|
boolean |
isAuthorized(Subject subject,
URI resource,
String action)
Determines whether the given Subject is authorized to access the given resource,
specified by a URI.
|
boolean |
isPermissionGranted(Subject subject,
Permission permission)
Determines whether the given Subject has been granted the specified Permission
by delegating to the configured java.security.Policy object.
|
AzAction |
makeAzAction(String action)
Converts an action, expressed as a String, into a typed attributes collection.
|
AzResource |
makeAzResource(URI resource)
Converts a resource, expressed as a URI, into a typed attributes collection.
|
AzSubject |
makeAzSubject(Subject subject)
Converts a Java Subject into a typed attributes collection.
|
boolean |
removeAllAttributeResolvers()
Removes all
AttributeResolver instances from the current
internal list of AttributeResolver instances. |
void |
setAttributeResolvers(List<AzAttributeResolver> resolverList)
Replaces the internal list of
AttributeResolver instances
with the given list. |
initializeboolean isPermissionGranted(Subject subject, Permission permission)
subject - The Subject for which permission is being tested.permission - The Permission being queried.IllegalArgumentException - Given null or illegal subject or permissionboolean isAuthorized(Subject subject, URI resource)
subject - The Subject being tested.resource - URI of the resource being tested.IllegalArgumentException - Given null or illegal subject or resourceIllegalStateException - Service was not initialized.boolean isAuthorized(Subject subject, URI resource, String action)
subject - The Subject being tested.resource - URI of the resource being tested.action - The action, with respect to the resource parameter,
for which authorization is desired. To check authorization for all actions,
action is represented by null or "*".IllegalArgumentException - Given null or illegal subject or resourceIllegalStateException - Service was not initialized.AzResult getAuthorizationDecision(AzSubject subject, AzResource resource, AzAction action)
subject - The attributes collection representing the Subject for which an authorization
decision is requested.resource - The attributes collection representing the resource for which access is
being requested.action - The attributes collection representing the action, with respect to the resource,
for which access is being requested. A null action is interpreted as all
actions, however all actions may also be represented by the AzAction instance.
See AzAction.IllegalArgumentException - Given null or illegal subject or resourceIllegalStateException - Service was not initialized.AzSubject makeAzSubject(Subject subject)
subject - The Subject to convert.IllegalArgumentException - Given null or illegal subjectAzResource makeAzResource(URI resource)
Query parameters in the given URI are appended to this
AzResource instance attributes collection.
resource - The URI to convert.IllegalArgumentException - Given null or illegal resourceAzAction makeAzAction(String action)
action - The action to convert. null or "*" represents all actions.AuthorizationService.PolicyDeploymentContext findOrCreateDeploymentContext(String appContext)
appContext - The application context for which the PolicyDeploymentContext
is desired.IllegalStateException - Service was not initialized.boolean appendAttributeResolver(AzAttributeResolver resolver)
AzAttributeResolver
instance to the internal ordered list of AzAttributeResolver instances,
if not currently in the list based on
org.glassfish.security.services.api.authorization.AzAttributeResolver#equals.resolver - The AzAttributeResolver instance to append.AzAttributeResolver was added,
false if the AzAttributeResolver was already in the list.IllegalArgumentException - Given AzAttributeResolver was null.void setAttributeResolvers(List<AzAttributeResolver> resolverList)
AttributeResolver instances
with the given list. If multiple equivalent instances exist in the given list,
only the first such instance will be inserted.resolverList - Replacement list of AzAttributeResolver instancesIllegalArgumentException - Given AzAttributeResolver list was null.List<AzAttributeResolver> getAttributeResolvers()
AttributeResolver instances,
in execution order.boolean removeAllAttributeResolvers()
AttributeResolver instances from the current
internal list of AttributeResolver instances.AttributeResolver instances were removed,
false if the list was empty.Copyright © 2013. All Rights Reserved.