Gemfire JavaDocs_test
Class RestrictedMethodAuthorizer
- java.lang.Object
-
- org.apache.geode.cache.query.security.RestrictedMethodAuthorizer
-
- All Implemented Interfaces:
MethodInvocationAuthorizer
public final class RestrictedMethodAuthorizer extends java.lang.Object implements MethodInvocationAuthorizer
The default, immutable and thread-safeMethodInvocationAuthorizer
used by Geode to determine whether aMethod
is allowed to be executed on a specificObject
instance.This authorizer addresses the four known security risks:
Java Reflection
,Cache Modification
,Region Modification
andRegion Entry Modification
.Custom applications can delegate to this class and use it as the starting point for providing use case specific authorizers.
- See Also:
Cache
,MethodInvocationAuthorizer
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
UNAUTHORIZED_STRING
-
Constructor Summary
Constructors Constructor Description RestrictedMethodAuthorizer(Cache cache)
Creates aRestrictedMethodAuthorizer
object and initializes it so it can be safely used in a multi-threaded environment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
authorize(java.lang.reflect.Method method, java.lang.Object target)
Executes the authorization logic to determine whether themethod
is allowed to be executed on thetarget
object instance.boolean
isAllowedGeodeMethod(java.lang.reflect.Method method, java.lang.Object target)
Executes the verification logic to determine whether thetarget
object instance belongs to Geode and whether themethod
on thetarget
object instance is considered to be safe according to Geode security rules.boolean
isPermanentlyForbiddenMethod(java.lang.reflect.Method method, java.lang.Object target)
Executes the verification logic to determine whether themethod
on thetarget
object instance is considered to be non safe according to Geode security rules.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.geode.cache.query.security.MethodInvocationAuthorizer
initialize
-
-
-
-
Field Detail
-
UNAUTHORIZED_STRING
public static final java.lang.String UNAUTHORIZED_STRING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RestrictedMethodAuthorizer
public RestrictedMethodAuthorizer(Cache cache)
Creates aRestrictedMethodAuthorizer
object and initializes it so it can be safely used in a multi-threaded environment.If the
Cache
instance passed as parameter was previously created by Geode, the authorizer will use the security service already configured in order to determine whether a specific user has read privileges upon a particular region. If theCache
instance passed as parameter is a wrapper created by external frameworks, the authorizer will create a new instance of the security service using the configuration properties used to initialize the cache.Applications can also use this constructor as part of the initialization for custom authorizers (see
Declarable.initialize(Cache, Properties)
), when using a declarative approach.- Parameters:
cache
- theCache
instance that owns this authorizer, required in order to configure the security rules used.
-
-
Method Detail
-
isAllowedGeodeMethod
public boolean isAllowedGeodeMethod(java.lang.reflect.Method method, java.lang.Object target)
Executes the verification logic to determine whether thetarget
object instance belongs to Geode and whether themethod
on thetarget
object instance is considered to be safe according to Geode security rules. If thetarget
object is an instance ofRegion
, this methods also ensures that the user has theDATA:READ
permission granted for the targetRegion
.- Parameters:
method
- theMethod
that should be verified.target
- theObject
on which theMethod
will be executed.- Returns:
true
if and only if thetarget
object instance belongs to Geode and themethod
is considered safe to be executed on thetarget
object instance according to the Geode security rules,false
otherwise.
-
isPermanentlyForbiddenMethod
public boolean isPermanentlyForbiddenMethod(java.lang.reflect.Method method, java.lang.Object target)
Executes the verification logic to determine whether themethod
on thetarget
object instance is considered to be non safe according to Geode security rules.The following methods are currently considered non safe, no matter what the
target
object is:getClass
readObject
readResolve
readObjectNoData
writeObject
writeReplace
- Parameters:
method
- theMethod
that should be verified.target
- theObject
on which theMethod
will be executed.- Returns:
true
if themethod
is considered non safe to be executed on thetarget
instance according to the Geode security rules,false
otherwise.
-
authorize
public boolean authorize(java.lang.reflect.Method method, java.lang.Object target)
Executes the authorization logic to determine whether themethod
is allowed to be executed on thetarget
object instance. If thetarget
object is an instance ofRegion
, this methods also ensures that the user has theDATA:READ
permission granted for the targetRegion
.- Specified by:
authorize
in interfaceMethodInvocationAuthorizer
- Parameters:
method
- theMethod
that should be authorized.target
- theObject
on which theMethod
will be executed.- Returns:
true
if themethod
can be executed on on thetarget
instance,false
otherwise.- See Also:
MethodInvocationAuthorizer
-
-