P
- Supported Permission typepublic interface Authorizer<P extends Permission>
Authentication
authorization control using
Authentication.getPermissions()
permissions.Modifier and Type | Method and Description |
---|---|
static Authorizer<Permission> |
create()
Create a default Authorizer.
|
Class<? extends P> |
getPermissionType()
Get supported
Permission type |
boolean |
isPermitted(Authentication authentication,
Collection<? extends P> permissions)
Check if given Authentication has all the specified permissions.
|
boolean |
isPermitted(Authentication authentication,
String... permissions)
Check if given Authentication has all specified permission/s, using the
String permission representation. |
default <T extends P> |
isPermitted(Authentication authentication,
T... permissions)
Check if given Authentication has all the specified permission/s.
|
boolean |
isPermittedAny(Authentication authentication,
Collection<? extends P> permissions)
Check if given Authentication has any of the specified permissions.
|
boolean |
isPermittedAny(Authentication authentication,
String... permissions)
Check if given Authentication has any of the specified permission/s, using the
String permission
representation. |
default <T extends P> |
isPermittedAny(Authentication authentication,
T... permissions)
Check if given Authentication has any of the specified permission/s.
|
Class<? extends P> getPermissionType()
Permission
typePermission
typeboolean isPermitted(Authentication authentication, Collection<? extends P> permissions)
authentication
- The Authentication for which to check the permissionspermissions
- The permissions to be checkedtrue
if given Authentication has all the specified permissionsdefault <T extends P> boolean isPermitted(Authentication authentication, T... permissions)
T
- Permission typeauthentication
- The Authentication for which to check the permissionspermissions
- The permissions to be checkedtrue
if given Authentication has all the specified permissionsboolean isPermitted(Authentication authentication, String... permissions)
String
permission representation.
String permission match against Authentication Permission
s should be performed using the
Permission.getPermission()
method.
authentication
- The Authentication for which to check the permissionspermissions
- The permissions to be checkedtrue
if given Authentication has all the specified permissionsboolean isPermittedAny(Authentication authentication, Collection<? extends P> permissions)
authentication
- The Authentication for which to check the permissionspermissions
- The permissions to be checkedtrue
if given Authentication has any of the specified permissiondefault <T extends P> boolean isPermittedAny(Authentication authentication, T... permissions)
T
- Permission typeauthentication
- The Authentication for which to check the permissionspermissions
- The permissions to be checkedtrue
if given Authentication has any of the specified permissionboolean isPermittedAny(Authentication authentication, String... permissions)
String
permission
representation.
String permission match against Authentication Permission
s will be performed using
Permission.getPermission()
method.
authentication
- The Authentication for which to check the permissionspermissions
- The permissions to be checkedtrue
if given Authentication has any of the specified permissionstatic Authorizer<Permission> create()
The default Authorizer never throws exceptions, adopting the following behaviour:
null
Authentication
is given, always returns false
null
or empty permissions are given, always returns false
Authentication
is not null
and is root
, always returns
true
Permission.equals(Object)
to compare a single permission to anotherDefaultAuthorizer
Copyright © 2019 The Holon Platform. All rights reserved.