Class ApacheShiroSecurityConfiguration
java.lang.Object
org.springframework.data.gemfire.config.annotation.support.AbstractAnnotationConfigSupport
org.springframework.data.gemfire.config.annotation.ApacheShiroSecurityConfiguration
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,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
- Author:
- John Blum
- 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
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 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(BeanFactory beanFactory) Sets a reference to the SpringBeanFactory.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.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, getLog, hasValue, hasValue, hasValue, httpServiceProperty, isAnnotationPresent, isAnnotationPresent, isNotInfrastructureBean, isNotInfrastructureBean, isNotInfrastructureClass, isNotInfrastructureClass, isNotInfrastructureRole, isUserLevelMethod, locatorProperty, logDebug, logDebug, logError, logError, loggingProperty, logInfo, logInfo, logWarning, logWarning, managementProperty, managerProperty, memcachedServiceProperty, namedCacheServerProperty, namedDiskStoreProperty, namedGatewaySenderProperty, namedPoolProperty, newEvaluationContext, newLog, pdxProperty, poolProperty, propertyName, redisServiceProperty, register, register, requireProperty, resolveAnnotation, resolveBeanClass, resolveBeanClass, resolveBeanClass, 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
Sets a reference to the SpringBeanFactory.- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Overrides:
setBeanFactoryin classAbstractAnnotationConfigSupport- Parameters:
beanFactory- reference to the SpringBeanFactory.- Throws:
IllegalArgumentException- if the SpringBeanFactoryis not an instance ofListableBeanFactory.BeansException- See Also:
-
getListableBeanFactory
Returns a reference to the SpringBeanFactory.- Returns:
- a reference to the Spring
BeanFactory. - Throws:
IllegalStateException- if the SpringBeanFactorywas not set.- See Also:
-
shiroGemFireBeanFactoryPostProcessor
-
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
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:
-
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
-