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

    Constructors
    Constructor
    Description
    Constructs a new instance of SecurityManagerProxy, which will delegate all Apache Geode security operations to a Spring managed SecurityManager bean.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    boolean
    authorize(Object principal, org.apache.geode.security.ResourcePermission permission)
     
    void
     
    void
     
    Returns a reference to the single SecurityManagerProxy instance configured by Apache Geode in startup.
    protected org.apache.geode.security.SecurityManager
    Returns a reference to the Apache Geode SecurityManager instance delegated to by this SecurityManagerProxy.
    void
     
    protected org.springframework.beans.factory.BeanFactory
     
    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.

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SecurityManagerProxy

      public SecurityManagerProxy()
      Constructs a new instance of SecurityManagerProxy, which will delegate all Apache Geode security operations to a Spring managed SecurityManager bean.
  • Method Details

    • getInstance

      public static SecurityManagerProxy getInstance()
      Returns a reference to the single SecurityManagerProxy 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 Spring BeanFactory.
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Parameters:
      beanFactory - reference to the current Spring BeanFactory.
      Throws:
      org.springframework.beans.BeansException - if this operation fails to configure the reference to the BeanFactory.
      See Also:
      • BeanFactory
    • setSecurityManager

      @Autowired public void setSecurityManager(org.apache.geode.security.SecurityManager securityManager)
      Configures a reference to the Apache Geode SecurityManager instance delegated to by this SecurityManagerProxy.
      Parameters:
      securityManager - reference to the underlying Apache Geode SecurityManager instance delegated to by this SecurityManagerProxy.
      Throws:
      IllegalArgumentException - if the SecurityManager reference is null.
      See Also:
      • SecurityManager
    • getSecurityManager

      protected org.apache.geode.security.SecurityManager getSecurityManager()
      Returns a reference to the Apache Geode SecurityManager instance delegated to by this SecurityManagerProxy.
      Returns:
      a reference to the underlying SecurityManager instance delegated to by this SecurityManagerProxy.
      Throws:
      IllegalStateException - if the configured SecurityManager was not properly configured.
      See Also:
      • SecurityManager
    • authenticate

      public Object authenticate(Properties properties) throws org.apache.geode.security.AuthenticationFailedException
      Specified by:
      authenticate in interface org.apache.geode.security.SecurityManager
      Throws:
      org.apache.geode.security.AuthenticationFailedException
    • authorize

      public boolean authorize(Object principal, org.apache.geode.security.ResourcePermission permission)
      Specified by:
      authorize in interface org.apache.geode.security.SecurityManager
    • close

      public void close()
      Specified by:
      close in interface org.apache.geode.cache.CacheCallback
      Specified by:
      close in interface org.apache.geode.security.SecurityManager
      Overrides:
      close in class org.springframework.data.gemfire.support.DeclarableSupport
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Overrides:
      destroy in class org.springframework.data.gemfire.support.LazyWiringDeclarableSupport
      Throws:
      Exception
    • init

      public void init(Properties props)
      Specified by:
      init in interface org.apache.geode.cache.Declarable
      Specified by:
      init in interface org.apache.geode.security.SecurityManager
    • locateBeanFactory

      protected org.springframework.beans.factory.BeanFactory locateBeanFactory()
      Overrides:
      locateBeanFactory in class org.springframework.data.gemfire.support.DeclarableSupport