@Service @Singleton public final class AuthorizationServiceImpl extends Object implements AuthorizationService, org.glassfish.hk2.api.PostConstruct
AuthorizationServiceImpl implements
AuthorizationService
by delegating authorization decisions to configured
AuthorizationProvider
instances.AuthorizationService.PolicyDeploymentContext| Constructor and Description |
|---|
AuthorizationServiceImpl() |
| 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)
Find 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.
|
void |
initialize(SecurityConfiguration securityServiceConfiguration)
Initialize the security service instance with the specific security service configuration.
|
boolean |
isAuthorized(Subject subject,
URI resource)
Determine whether the given Subject is authorized to access the given resource,
specified by a URI.
|
boolean |
isAuthorized(Subject subject,
URI resource,
String action)
Determine whether the given Subject is authorized to access the given resource,
specified by a URI.
|
boolean |
isPermissionGranted(Subject subject,
Permission permission)
Determine whether the given Subject has been granted the specified Permission
by delegating to the configured java.security.Policy object.
|
AzAction |
makeAzAction(String action)
Convert an action, expressed as a String, into a typed attributes collection.
|
AzResource |
makeAzResource(URI resource)
Convert a resource, expressed as a URI, into a typed attributes collection.
|
AzSubject |
makeAzSubject(Subject subject)
Convert a Java Subject into a typed attributes collection.
|
void |
postConstruct()
Called when the instance has been created and the component is
about to be place into commission.
|
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. |
public void initialize(SecurityConfiguration securityServiceConfiguration)
initialize in interface SecurityServiceSecurityService.initialize(org.glassfish.security.services.config.SecurityConfiguration)public boolean isPermissionGranted(Subject subject, Permission permission)
isPermissionGranted in interface AuthorizationServicesubject - The Subject for which permission is being tested.permission - The Permission being queried.IllegalArgumentException - Given null or illegal subject or permissionAuthorizationService.isPermissionGranted(javax.security.auth.Subject, java.security.Permission)public boolean isAuthorized(Subject subject, URI resource)
isAuthorized in interface AuthorizationServicesubject - The Subject being tested.resource - URI of the resource being tested.IllegalArgumentException - Given null or illegal subject or resourceIllegalStateException - Service was not initialized.AuthorizationService.isAuthorized(javax.security.auth.Subject, java.net.URI)public boolean isAuthorized(Subject subject, URI resource, String action)
isAuthorized in interface AuthorizationServicesubject - 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.AuthorizationService.isAuthorized(javax.security.auth.Subject, java.net.URI, String)public AzResult getAuthorizationDecision(AzSubject subject, AzResource resource, AzAction action)
getAuthorizationDecision in interface AuthorizationServicesubject - 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.AuthorizationService.getAuthorizationDecision(org.glassfish.security.services.api.authorization.AzSubject, org.glassfish.security.services.api.authorization.AzResource, org.glassfish.security.services.api.authorization.AzAction)public AzSubject makeAzSubject(Subject subject)
makeAzSubject in interface AuthorizationServicesubject - The Subject to convert.IllegalArgumentException - Given null or illegal subjectAuthorizationService.makeAzSubject(javax.security.auth.Subject)public AzResource makeAzResource(URI resource)
Query parameters in the given URI are appended to this
AzResource instance attributes collection.
makeAzResource in interface AuthorizationServiceresource - The URI to convert.IllegalArgumentException - Given null or illegal resourceAuthorizationService.makeAzResource(java.net.URI)public AzAction makeAzAction(String action)
makeAzAction in interface AuthorizationServiceaction - The action to convert. null or "*" represents all actions.AuthorizationService.makeAzAction(String)public AuthorizationService.PolicyDeploymentContext findOrCreateDeploymentContext(String appContext)
findOrCreateDeploymentContext in interface AuthorizationServiceappContext - The application context for which the PolicyDeploymentContext
is desired.IllegalStateException - Service was not initialized.AuthorizationService.findOrCreateDeploymentContext(String)public void postConstruct()
The component has been injected with any dependency and will be placed into commission by the subsystem.
Hk2 will catch all unchecked exceptions, and will consequently cause the backing inhabitant to be released.
postConstruct in interface org.glassfish.hk2.api.PostConstructPostConstruct.postConstruct()public 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.appendAttributeResolver in interface AuthorizationServiceresolver - The AzAttributeResolver instance to append.AzAttributeResolver was added,
false if the AzAttributeResolver was already in the list.IllegalArgumentException - Given AzAttributeResolver was null.AuthorizationService.appendAttributeResolver(org.glassfish.security.services.api.authorization.AzAttributeResolver)public 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.setAttributeResolvers in interface AuthorizationServiceresolverList - Replacement list of AzAttributeResolver instancesIllegalArgumentException - Given AzAttributeResolver list was null.AuthorizationService.setAttributeResolvers(java.util.List<org.glassfish.security.services.api.authorization.AzAttributeResolver>)public List<AzAttributeResolver> getAttributeResolvers()
AttributeResolver instances,
in execution order.getAttributeResolvers in interface AuthorizationServiceAuthorizationService.getAttributeResolvers()public boolean removeAllAttributeResolvers()
AttributeResolver instances from the current
internal list of AttributeResolver instances.removeAllAttributeResolvers in interface AuthorizationServiceAttributeResolver instances were removed,
false if the list was empty.AuthorizationService.removeAllAttributeResolvers()Copyright © 2013. All Rights Reserved.