public class PermissionAnnotationHandler extends AuthorizingAnnotationHandler
RequiresPermissions
annotation is
declared, and if so, performs a permission check to see if the calling Subject
is allowed continued
access.annotationClass
Constructor and Description |
---|
PermissionAnnotationHandler()
Default no-argument constructor that ensures this handler looks for
RequiresPermissions annotations. |
Modifier and Type | Method and Description |
---|---|
void |
assertAuthorized(Annotation a)
Ensures that the calling
Subject has the Annotation's specified permissions, and if not, throws an
AuthorizingException indicating access is denied. |
protected String[] |
getAnnotationValue(Annotation a)
Returns the annotation
value , from which the Permission will be constructed. |
getAnnotationClass, getSubject, setAnnotationClass
public PermissionAnnotationHandler()
RequiresPermissions
annotations.protected String[] getAnnotationValue(Annotation a)
value
, from which the Permission will be constructed.a
- the RequiresPermissions annotation being inspected.value
, from which the Permission will be constructed.public void assertAuthorized(Annotation a) throws AuthorizationException
Subject
has the Annotation's specified permissions, and if not, throws an
AuthorizingException
indicating access is denied.assertAuthorized
in class AuthorizingAnnotationHandler
a
- the RequiresPermission annotation being inspected to check for one or more permissionsAuthorizationException
- if the calling Subject
does not have the permission(s) necessary to
continue access or execution.Copyright © 2004–2019 The Apache Software Foundation. All rights reserved.