Class SecurityManagerProxy
java.lang.Object
org.springframework.data.gemfire.support.DeclarableSupport
org.springframework.data.gemfire.support.WiringDeclarableSupport
org.springframework.data.gemfire.support.LazyWiringDeclarableSupport
org.springframework.geode.security.support.SecurityManagerProxy
- All Implemented Interfaces:
EventListener
,org.apache.geode.cache.CacheCallback
,org.apache.geode.cache.Declarable
,org.apache.geode.security.SecurityManager
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
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
The
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);
}
...
}
- Since:
- 1.0.0
- See Also:
-
ResourcePermission
SecurityManager
BeanFactory
BeanFactoryAware
DisposableBean
Autowired
LazyWiringDeclarableSupport
-
Field Summary
Fields inherited from class org.springframework.data.gemfire.support.WiringDeclarableSupport
TEMPLATE_BEAN_NAME_PROPERTY
Fields inherited from interface org.apache.geode.security.SecurityManager
PASSWORD, TOKEN, USER_NAME
-
Constructor Summary
ConstructorDescriptionConstructs a new instance ofSecurityManagerProxy
, which will delegate all Apache Geode security operations to a Spring managedSecurityManager
bean. -
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(Properties properties) boolean
void
close()
void
destroy()
static SecurityManagerProxy
Returns a reference to the singleSecurityManagerProxy
instance configured by Apache Geode in startup.protected org.apache.geode.security.SecurityManager
Returns a reference to the Apache GeodeSecurityManager
instance delegated to by thisSecurityManagerProxy
.void
init
(Properties props) protected org.springframework.beans.factory.BeanFactory
void
setBeanFactory
(org.springframework.beans.factory.BeanFactory beanFactory) Configures a reference to the current SpringBeanFactory
.void
setSecurityManager
(org.apache.geode.security.SecurityManager securityManager) Configures a reference to the Apache GeodeSecurityManager
instance delegated to by thisSecurityManagerProxy
.Methods inherited from class org.springframework.data.gemfire.support.LazyWiringDeclarableSupport
assertInitialized, assertUninitialized, doPostInit, initialize, isInitialized, isNotInitialized, nullSafeGetParameters, onApplicationEvent, setParameters
Methods inherited from class org.springframework.data.gemfire.support.WiringDeclarableSupport
configureThis, configureThis, newBeanConfigurer, newBeanConfigurer
Methods inherited from class org.springframework.data.gemfire.support.DeclarableSupport
getBeanFactory, getBeanFactoryKey, locateBeanFactory, setBeanFactoryKey
-
Constructor Details
-
SecurityManagerProxy
public SecurityManagerProxy()Constructs a new instance ofSecurityManagerProxy
, which will delegate all Apache Geode security operations to a Spring managedSecurityManager
bean.
-
-
Method Details
-
getInstance
Returns a reference to the singleSecurityManagerProxy
instance configured by Apache Geode in startup.- Returns:
- a reference to the single
SecurityManagerProxy
instance.
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException Configures a reference to the current SpringBeanFactory
.- Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Parameters:
beanFactory
- reference to the current SpringBeanFactory
.- Throws:
org.springframework.beans.BeansException
- if this operation fails to configure the reference to theBeanFactory
.- See Also:
-
BeanFactory
-
setSecurityManager
@Autowired public void setSecurityManager(org.apache.geode.security.SecurityManager securityManager) Configures a reference to the Apache GeodeSecurityManager
instance delegated to by thisSecurityManagerProxy
.- Parameters:
securityManager
- reference to the underlying Apache GeodeSecurityManager
instance delegated to by thisSecurityManagerProxy
.- Throws:
IllegalArgumentException
- if theSecurityManager
reference is null.- See Also:
-
SecurityManager
-
getSecurityManager
protected org.apache.geode.security.SecurityManager getSecurityManager()Returns a reference to the Apache GeodeSecurityManager
instance delegated to by thisSecurityManagerProxy
.- Returns:
- a reference to the underlying
SecurityManager
instance delegated to by thisSecurityManagerProxy
. - Throws:
IllegalStateException
- if the configuredSecurityManager
was not properly configured.- See Also:
-
SecurityManager
-
authenticate
public Object authenticate(Properties properties) throws org.apache.geode.security.AuthenticationFailedException - Specified by:
authenticate
in interfaceorg.apache.geode.security.SecurityManager
- Throws:
org.apache.geode.security.AuthenticationFailedException
-
authorize
- Specified by:
authorize
in interfaceorg.apache.geode.security.SecurityManager
-
close
public void close()- Specified by:
close
in interfaceorg.apache.geode.cache.CacheCallback
- Specified by:
close
in interfaceorg.apache.geode.security.SecurityManager
- Overrides:
close
in classorg.springframework.data.gemfire.support.DeclarableSupport
-
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Overrides:
destroy
in classorg.springframework.data.gemfire.support.LazyWiringDeclarableSupport
- Throws:
Exception
-
init
- Specified by:
init
in interfaceorg.apache.geode.cache.Declarable
- Specified by:
init
in interfaceorg.apache.geode.security.SecurityManager
-
locateBeanFactory
protected org.springframework.beans.factory.BeanFactory locateBeanFactory()- Overrides:
locateBeanFactory
in classorg.springframework.data.gemfire.support.DeclarableSupport
-