public class SimpleAccessController extends java.lang.Object implements AccessControl
AccessControl
, mirroring
the structure of SimpleSecurityManager
. An authenticated user's
permissions are defined by the username itself, e.g., user "dataRead" has permissions DATA:READ
and user "data,cluster" has permissions DATA and CLUSTER.Constructor and Description |
---|
SimpleAccessController() |
Modifier and Type | Method and Description |
---|---|
boolean |
authorizeOperation(java.lang.String regionName,
OperationContext context)
Check if the given operation is allowed for the cache/region.
|
void |
close()
Called when the region containing this callback is closed or destroyed, when the cache is
closed, or when a callback is removed from a region using an
AttributesMutator . |
static AccessControl |
create() |
void |
init(java.security.Principal principal,
DistributedMember remoteMember,
Cache cache)
Initialize the callback for a client/peer having the given principal.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
init, init
init, initialize
public void init(java.security.Principal principal, DistributedMember remoteMember, Cache cache) throws NotAuthorizedException
AccessControl
authorizeOperation
in each operation.init
in interface AccessControl
principal
- the principal associated with the authenticated client or peer; a null
principal implies an unauthenticated client which should be handled properly by
implementationsremoteMember
- the DistributedMember
object for the remote authenticated client or
peercache
- reference to the cache objectNotAuthorizedException
- if some exception condition happens during the initialization;
in such a case all subsequent client operations on that connection will throw
NotAuthorizedException
public static AccessControl create()
public boolean authorizeOperation(java.lang.String regionName, OperationContext context)
AccessControl
init
call made
when the connection was established so that this call is as quick as possible.authorizeOperation
in interface AccessControl
regionName
- When null then it indicates a cache-level operation (i.e. one of
OperationContext.OperationCode.REGION_DESTROY
or OperationContext.OperationCode.QUERY
, else
the name of the region for the operation.context
- When invoked before the operation then the data required by the operation. When
invoked as a post-process filter then it contains the result of the operation. The data
in the context can be possibly modified by the method.public void close()
CacheCallback
AttributesMutator
.
Implementations should cleanup any external resources such as database connections. Any runtime exceptions this method throws will be logged.
It is possible for this method to be called multiple times on a single callback instance, so implementations must be tolerant of this.
close
in interface CacheCallback
RegionService.close()
,
Region.close()
,
Region.localDestroyRegion()
,
Region.destroyRegion()
,
AttributesMutator