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:
-
GemFireCache
SecurityService
DefaultSecurityManager
Realm
LifecycleBeanPostProcessor
BeanFactory
ListableBeanFactory
Bean
Condition
Conditional
Configuration
AnnotationMetadata
ApacheShiroSecurityConfiguration.ApacheShiroPresentCondition
AbstractAnnotationConfigSupport
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A SpringCondition
to 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected Class<? extends Annotation>
protected ListableBeanFactory
Returns a reference to the SpringBeanFactory
.protected org.apache.shiro.mgt.SecurityManager
registerSecurityManager
(org.apache.shiro.mgt.SecurityManager securityManager) Registers the given Apache ShiroSecurityManager
with the Apache Shiro security framework.protected List<org.apache.shiro.realm.Realm>
Resolves all the Apache ShiroRealms
declared and configured as Spring managed beans in the SpringApplicationContext
.void
setBeanFactory
(BeanFactory beanFactory) Sets a reference to the SpringBeanFactory
.Bean
definition to define, configure and register an Apache Shiro SpringLifecycleBeanPostProcessor
to automatically call lifecycle callback methods on Shiro security components during Spring container initialization and destruction phases.org.apache.shiro.mgt.SecurityManager
Bean
definition to define, configure and register an Apache ShiroSecurityManager
implementation 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:
getAnnotationType
in classAbstractAnnotationConfigSupport
- Returns:
- the
EnableSecurity
Annotation
Class
type. - See Also:
-
setBeanFactory
Sets a reference to the SpringBeanFactory
.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Overrides:
setBeanFactory
in classAbstractAnnotationConfigSupport
- Parameters:
beanFactory
- reference to the SpringBeanFactory
.- Throws:
IllegalArgumentException
- if the SpringBeanFactory
is 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 SpringBeanFactory
was not set.- See Also:
-
shiroGemFireBeanFactoryPostProcessor
-
shiroLifecycleBeanPostProcessor
Bean
definition to define, configure and register an Apache Shiro SpringLifecycleBeanPostProcessor
to automatically call lifecycle callback methods on Shiro security components during Spring container initialization and destruction phases.- Returns:
- an instance of the Apache Shiro Spring
LifecycleBeanPostProcessor
to handle the lifecycle of Apache Shiro security framework components. - See Also:
-
LifecycleBeanPostProcessor
-
shiroSecurityManager
Bean
definition to define, configure and register an Apache ShiroSecurityManager
implementation to secure Apache Geode. The registration of thisBean
definition is dependent upon whether the user is using Apache Shiro to secure Apache Geode, which is determined by the presence of Apache ShiroRealms
declared in the SpringApplicationContext
. ThisBean
definition declares a dependency on the Apache GeodeGemFireCache
instance 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, thisBean
definition will register the Apache ShiroSecurityManager
with the Apache Shiro security framework Finally, this method proceeds to enable Apache Geode security.- Returns:
- an Apache Shiro
SecurityManager
implementation used to secure Apache Geode. - Throws:
IllegalStateException
- if an Apache ShiroSecurityManager
was registered with the Apache Shiro security framework but Apache Geode security could not be enabled.- See Also:
-
resolveRealms
Resolves all the Apache ShiroRealms
declared 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
List
of all Apache ShiroRealms
declared 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 ShiroSecurityManager
with the Apache Shiro security framework.- Parameters:
securityManager
-SecurityManager
to register.- Returns:
- the given
SecurityManager
reference. - Throws:
IllegalArgumentException
- ifSecurityManager
is null.- See Also:
-
SecurityUtils.setSecurityManager(org.apache.shiro.mgt.SecurityManager)
SecurityManager
-