Spring Data for VMware GemFire
Class ApacheShiroSecurityConfiguration
java.lang.Object
org.springframework.data.gemfire.config.annotation.support.AbstractAnnotationConfigSupport
org.springframework.data.gemfire.config.annotation.ApacheShiroSecurityConfiguration
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.context.EnvironmentAware
@Configuration
@Conditional(ApacheShiroPresentCondition.class)
public class ApacheShiroSecurityConfiguration
extends AbstractAnnotationConfigSupport
The
ApacheShiroSecurityConfiguration class is a Spring @Configuration component
responsible for configuring and initializing the Apache Shiro security framework in order to secure Apache Geode
administrative and data access operations.- Since:
- 1.9.0
- See Also:
-
GemFireCacheSecurityServiceDefaultSecurityManagerRealmLifecycleBeanPostProcessorBeanFactoryListableBeanFactoryBeanConditionConditionalConfigurationAnnotationMetadataApacheShiroSecurityConfiguration.ApacheShiroPresentConditionAbstractAnnotationConfigSupport
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA SpringConditionto determine whether the user has included (declared) the 'shiro-spring' dependency on their application's classpath, which is necessary for configuring Apache Shiro to secure Apache Geode in a Spring context.Nested classes/interfaces inherited from class org.springframework.data.gemfire.config.annotation.support.AbstractAnnotationConfigSupport
AbstractAnnotationConfigSupport.TypeResolver<T> -
Field Summary
Fields inherited from class org.springframework.data.gemfire.config.annotation.support.AbstractAnnotationConfigSupport
CURRENT_THREAD_CONTEXT_CLASS_LOADER, INFRASTRUCTURE_ROLES, ORG_SPRINGFRAMEWORK_DATA_GEMFIRE_PACKAGE, ORG_SPRINGFRAMEWORK_PACKAGE, SPRING_DATA_GEMFIRE_PROPERTY_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<? extends Annotation>protected org.springframework.beans.factory.ListableBeanFactoryReturns a reference to the SpringBeanFactory.protected org.apache.shiro.mgt.SecurityManagerregisterSecurityManager(org.apache.shiro.mgt.SecurityManager securityManager) Registers the given Apache ShiroSecurityManagerwith the Apache Shiro security framework.protected List<org.apache.shiro.realm.Realm>Resolves all the Apache ShiroRealmsdeclared and configured as Spring managed beans in the SpringApplicationContext.voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) Sets a reference to the SpringBeanFactory.org.springframework.beans.factory.config.BeanFactoryPostProcessororg.springframework.beans.factory.config.BeanPostProcessorBeandefinition to define, configure and register an Apache Shiro SpringLifecycleBeanPostProcessorto automatically call lifecycle callback methods on Shiro security components during Spring container initialization and destruction phases.org.apache.shiro.mgt.SecurityManagerBeandefinition to define, configure and register an Apache ShiroSecurityManagerimplementation to secure Apache Geode.Methods inherited from class org.springframework.data.gemfire.config.annotation.support.AbstractAnnotationConfigSupport
arrayOfPropertyNamesFor, arrayOfPropertyNamesFor, asArrayProperty, cacheClientProperty, cacheCompressionProperty, cacheOffHeapProperty, cachePeerProperty, cacheProperty, cacheServerProperty, clusterProperty, diskStoreProperty, entitiesProperty, gatewayReceiverProperty, gatewaySenderProperty, getAnnotationAttributes, getAnnotationAttributes, getAnnotationAttributes, getAnnotationTypeName, getAnnotationTypeSimpleName, getBeanClassLoader, getBeanFactory, getEnvironment, getEvaluationContext, getLogger, hasValue, hasValue, hasValue, httpServiceProperty, isAnnotationPresent, isAnnotationPresent, isNotInfrastructureBean, isNotInfrastructureBean, isNotInfrastructureClass, isNotInfrastructureRole, isUserLevelMethod, locatorProperty, logDebug, logDebug, logError, logError, loggingProperty, logInfo, logInfo, logWarning, logWarning, managementProperty, managerProperty, memcachedServiceProperty, namedCacheServerProperty, namedDiskStoreProperty, namedGatewaySenderProperty, namedPoolProperty, newEvaluationContext, newLogger, pdxProperty, poolProperty, propertyName, register, register, requireProperty, resolveAnnotation, resolveBeanClass, resolveBeanClass, resolveBeanClass, resolveBeanClassLoader, resolveBeanClassLoader, resolveBeanClassLoader, resolveBeanClassName, resolveProperty, resolveProperty, resolveProperty, resolveProperty, resolveProperty, resolveProperty, resolveProperty, resolveProperty, safeResolveType, securityProperty, serviceProperty, setBeanClassLoader, setEnvironment, sslProperty, statsProperty
-
Constructor Details
-
ApacheShiroSecurityConfiguration
public ApacheShiroSecurityConfiguration()
-
-
Method Details
-
getAnnotationType
- Specified by:
getAnnotationTypein classAbstractAnnotationConfigSupport- Returns:
- the
EnableSecurityAnnotationClasstype. - See Also:
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException Sets a reference to the SpringBeanFactory.- Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Overrides:
setBeanFactoryin classAbstractAnnotationConfigSupport- Parameters:
beanFactory- reference to the SpringBeanFactory.- Throws:
IllegalArgumentException- if the SpringBeanFactoryis not an instance ofListableBeanFactory.org.springframework.beans.BeansException- See Also:
-
BeanFactory
-
getListableBeanFactory
protected org.springframework.beans.factory.ListableBeanFactory getListableBeanFactory()Returns a reference to the SpringBeanFactory.- Returns:
- a reference to the Spring
BeanFactory. - Throws:
IllegalStateException- if the SpringBeanFactorywas not set.- See Also:
-
BeanFactory
-
shiroGemFireBeanFactoryPostProcessor
@Bean public org.springframework.beans.factory.config.BeanFactoryPostProcessor shiroGemFireBeanFactoryPostProcessor() -
shiroLifecycleBeanPostProcessor
@Bean public org.springframework.beans.factory.config.BeanPostProcessor shiroLifecycleBeanPostProcessor()Beandefinition to define, configure and register an Apache Shiro SpringLifecycleBeanPostProcessorto automatically call lifecycle callback methods on Shiro security components during Spring container initialization and destruction phases.- Returns:
- an instance of the Apache Shiro Spring
LifecycleBeanPostProcessorto handle the lifecycle of Apache Shiro security framework components. - See Also:
-
LifecycleBeanPostProcessor
-
shiroSecurityManager
@Bean public org.apache.shiro.mgt.SecurityManager shiroSecurityManager()Beandefinition to define, configure and register an Apache ShiroSecurityManagerimplementation to secure Apache Geode. The registration of thisBeandefinition is dependent upon whether the user is using Apache Shiro to secure Apache Geode, which is determined by the presence of Apache ShiroRealmsdeclared in the SpringApplicationContext. ThisBeandefinition declares a dependency on the Apache GeodeGemFireCacheinstance in order to ensure the Geode cache is created and initialized first. This ensures that any internal Geode security configuration logic is evaluated and processed before SDG attempts to configure Apache Shiro as Apache Geode's security provider. Additionally, thisBeandefinition will register the Apache ShiroSecurityManagerwith the Apache Shiro security framework Finally, this method proceeds to enable Apache Geode security.- Returns:
- an Apache Shiro
SecurityManagerimplementation used to secure Apache Geode. - Throws:
IllegalStateException- if an Apache ShiroSecurityManagerwas registered with the Apache Shiro security framework but Apache Geode security could not be enabled.- See Also:
-
resolveRealms
Resolves all the Apache ShiroRealmsdeclared and configured as Spring managed beans in the SpringApplicationContext. This method will order the Realms according to priority order to ensure that the Apache Shiro Realms are applied in the correct sequence, as declared/configured.- Returns:
- a
Listof all Apache ShiroRealmsdeclared and configured as Spring managed beans in the SpringApplicationContext. - See Also:
-
ListableBeanFactory.getBeansOfType(Class, boolean, boolean)OrderComparatorRealm
-
registerSecurityManager
protected org.apache.shiro.mgt.SecurityManager registerSecurityManager(org.apache.shiro.mgt.SecurityManager securityManager) Registers the given Apache ShiroSecurityManagerwith the Apache Shiro security framework.- Parameters:
securityManager-SecurityManagerto register.- Returns:
- the given
SecurityManagerreference. - Throws:
IllegalArgumentException- ifSecurityManageris null.- See Also:
-
SecurityUtils.setSecurityManager(org.apache.shiro.mgt.SecurityManager)SecurityManager
-