VMware GemFire Java API Reference
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-safeMethodInvocationAuthorizerused by Geode to determine whether aMethodis allowed to be executed on a specificObjectinstance.This authorizer addresses the four known security risks:
Java Reflection,Cache Modification,Region ModificationandRegion 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.StringUNAUTHORIZED_STRING
-
Constructor Summary
Constructors Constructor Description RestrictedMethodAuthorizer(Cache cache)Creates aRestrictedMethodAuthorizerobject 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 booleanauthorize(java.lang.reflect.Method method, java.lang.Object target)Executes the authorization logic to determine whether themethodis allowed to be executed on thetargetobject instance.booleanisAllowedGeodeMethod(java.lang.reflect.Method method, java.lang.Object target)Executes the verification logic to determine whether thetargetobject instance belongs to Geode and whether themethodon thetargetobject instance is considered to be safe according to Geode security rules.booleanisPermanentlyForbiddenMethod(java.lang.reflect.Method method, java.lang.Object target)Executes the verification logic to determine whether themethodon thetargetobject 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 aRestrictedMethodAuthorizerobject and initializes it so it can be safely used in a multi-threaded environment.If the
Cacheinstance 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 theCacheinstance 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- theCacheinstance 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 thetargetobject instance belongs to Geode and whether themethodon thetargetobject instance is considered to be safe according to Geode security rules. If thetargetobject is an instance ofRegion, this methods also ensures that the user has theDATA:READpermission granted for the targetRegion.- Parameters:
method- theMethodthat should be verified.target- theObjecton which theMethodwill be executed.- Returns:
trueif and only if thetargetobject instance belongs to Geode and themethodis considered safe to be executed on thetargetobject instance according to the Geode security rules,falseotherwise.
-
isPermanentlyForbiddenMethod
public boolean isPermanentlyForbiddenMethod(java.lang.reflect.Method method, java.lang.Object target)Executes the verification logic to determine whether themethodon thetargetobject instance is considered to be non safe according to Geode security rules.The following methods are currently considered non safe, no matter what the
targetobject is:getClassreadObjectreadResolvereadObjectNoDatawriteObjectwriteReplace
- Parameters:
method- theMethodthat should be verified.target- theObjecton which theMethodwill be executed.- Returns:
trueif themethodis considered non safe to be executed on thetargetinstance according to the Geode security rules,falseotherwise.
-
authorize
public boolean authorize(java.lang.reflect.Method method, java.lang.Object target)Executes the authorization logic to determine whether themethodis allowed to be executed on thetargetobject instance. If thetargetobject is an instance ofRegion, this methods also ensures that the user has theDATA:READpermission granted for the targetRegion.- Specified by:
authorizein interfaceMethodInvocationAuthorizer- Parameters:
method- theMethodthat should be authorized.target- theObjecton which theMethodwill be executed.- Returns:
trueif themethodcan be executed on on thetargetinstance,falseotherwise.- See Also:
MethodInvocationAuthorizer
-
-