public class SecurityManagerProxy
extends org.springframework.data.gemfire.support.LazyWiringDeclarableSupport
implements org.apache.geode.security.SecurityManager, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.BeanFactoryAware
SecurityManagerProxy
class is an Apache Geode SecurityManager
proxy implementation delegating to a backing SecurityManager
implementation
which is registered as a managed bean in a Spring context.
The idea behind this SecurityManager
is to enable users to be able to configure
and manage the SecurityManager
as a Spring bean. However, Apache Geode require
the SecurityManager
to be configured using a System property when launching
Apache Geode Servers with Gfsh, which makes it difficult to "manage" the SecurityManager
instance.
Therefore, this implementation allows a developer to set the Apache Geode System property using this proxy...
gemfire.security-manager=org.springframework.geode.security.support.SecurityManagerProxy
And then declare and define a bean in the Spring context implementing the
SecurityManager
interface...
Configuration
class MyApplicationConfiguration {
Bean
ExampleSecurityManager exampleSecurityManager(Environment environment) {
return new ExampleSecurityManager(environment);
}
...
}
ResourcePermission
,
SecurityManager
,
BeanFactory
,
BeanFactoryAware
,
DisposableBean
,
Autowired
,
LazyWiringDeclarableSupport
Constructor and Description |
---|
SecurityManagerProxy()
Constructs a new instance of
SecurityManagerProxy , which will delegate all Apache Geode
security operations to a Spring managed SecurityManager bean. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
authenticate(java.util.Properties properties) |
boolean |
authorize(java.lang.Object principal,
org.apache.geode.security.ResourcePermission permission) |
void |
close() |
void |
destroy() |
static SecurityManagerProxy |
getInstance()
Returns a reference to the single
SecurityManagerProxy instance configured by Apache Geode in startup. |
protected org.apache.geode.security.SecurityManager |
getSecurityManager()
Returns a reference to the Apache Geode
SecurityManager instance
delegated to by this SecurityManagerProxy . |
void |
init(java.util.Properties props) |
protected org.springframework.beans.factory.BeanFactory |
locateBeanFactory() |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Configures a reference to the current Spring
BeanFactory . |
void |
setSecurityManager(org.apache.geode.security.SecurityManager securityManager)
Configures a reference to the Apache Geode
SecurityManager instance
delegated to by this SecurityManagerProxy . |
assertInitialized, assertUninitialized, doPostInit, initialize, isInitialized, isNotInitialized, nullSafeGetParameters, onApplicationEvent, setParameters
configureThis, configureThis, newBeanConfigurer, newBeanConfigurer
getBeanFactory, getBeanFactoryKey, locateBeanFactory, setBeanFactoryKey
public SecurityManagerProxy()
SecurityManagerProxy
, which will delegate all Apache Geode
security operations to a Spring managed SecurityManager
bean.public static SecurityManagerProxy getInstance()
SecurityManagerProxy
instance configured by Apache Geode in startup.SecurityManagerProxy
instance.public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
BeanFactory
.setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
beanFactory
- reference to the current Spring BeanFactory
.org.springframework.beans.BeansException
- if this operation fails to configure the reference to the BeanFactory
.BeanFactory
@Autowired public void setSecurityManager(org.apache.geode.security.SecurityManager securityManager)
SecurityManager
instance
delegated to by this SecurityManagerProxy
.securityManager
- reference to the underlying Apache Geode SecurityManager
instance delegated to by this SecurityManagerProxy
.java.lang.IllegalArgumentException
- if the SecurityManager
reference
is null.SecurityManager
protected org.apache.geode.security.SecurityManager getSecurityManager()
SecurityManager
instance
delegated to by this SecurityManagerProxy
.SecurityManager
instance
delegated to by this SecurityManagerProxy
.java.lang.IllegalStateException
- if the configured SecurityManager
was not properly configured.SecurityManager
public java.lang.Object authenticate(java.util.Properties properties) throws org.apache.geode.security.AuthenticationFailedException
authenticate
in interface org.apache.geode.security.SecurityManager
org.apache.geode.security.AuthenticationFailedException
public boolean authorize(java.lang.Object principal, org.apache.geode.security.ResourcePermission permission)
authorize
in interface org.apache.geode.security.SecurityManager
public void close()
close
in interface org.apache.geode.cache.CacheCallback
close
in interface org.apache.geode.security.SecurityManager
close
in class org.springframework.data.gemfire.support.DeclarableSupport
public void destroy() throws java.lang.Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
destroy
in class org.springframework.data.gemfire.support.LazyWiringDeclarableSupport
java.lang.Exception
public void init(java.util.Properties props)
init
in interface org.apache.geode.cache.Declarable
init
in interface org.apache.geode.security.SecurityManager
protected org.springframework.beans.factory.BeanFactory locateBeanFactory()
locateBeanFactory
in class org.springframework.data.gemfire.support.DeclarableSupport