@Configuration @Conditional(value=ApacheShiroSecurityConfiguration.ApacheShiroPresentCondition.class) public class ApacheShiroSecurityConfiguration extends AbstractAnnotationConfigSupport
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.GemFireCache
,
SecurityService
,
DefaultSecurityManager
,
Realm
,
LifecycleBeanPostProcessor
,
BeanFactory
,
ListableBeanFactory
,
Bean
,
Condition
,
Conditional
,
Configuration
,
AnnotationMetadata
,
ApacheShiroSecurityConfiguration.ApacheShiroPresentCondition
,
AbstractAnnotationConfigSupport
Modifier and Type | Class and Description |
---|---|
static class |
ApacheShiroSecurityConfiguration.ApacheShiroPresentCondition
A Spring
Condition 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. |
AbstractAnnotationConfigSupport.TypeResolver<T>
INFRASTRUCTURE_ROLES, ORG_SPRINGFRAMEWORK_DATA_GEMFIRE_PACKAGE, ORG_SPRINGFRAMEWORK_PACKAGE, SPRING_DATA_GEMFIRE_PROPERTY_PREFIX
Constructor and Description |
---|
ApacheShiroSecurityConfiguration() |
Modifier and Type | Method and Description |
---|---|
protected Class<? extends Annotation> |
getAnnotationType()
|
protected ListableBeanFactory |
getListableBeanFactory()
Returns a reference to the Spring
BeanFactory . |
protected org.apache.shiro.mgt.SecurityManager |
registerSecurityManager(org.apache.shiro.mgt.SecurityManager securityManager)
Registers the given Apache Shiro
SecurityManager with the Apache Shiro
security framework. |
protected List<org.apache.shiro.realm.Realm> |
resolveRealms()
Resolves all the Apache Shiro
Realms declared and configured as Spring managed beans
in the Spring ApplicationContext . |
void |
setBeanFactory(BeanFactory beanFactory)
Sets a reference to the Spring
BeanFactory . |
BeanFactoryPostProcessor |
shiroGemFireBeanFactoryPostProcessor() |
BeanPostProcessor |
shiroLifecycleBeanPostProcessor()
Bean definition to define, configure and register an Apache Shiro Spring
LifecycleBeanPostProcessor to automatically call lifecycle callback methods
on Shiro security components during Spring container initialization and destruction phases. |
org.apache.shiro.mgt.SecurityManager |
shiroSecurityManager()
Bean definition to define, configure and register an Apache Shiro
SecurityManager implementation to secure Apache Geode. |
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
protected Class<? extends Annotation> getAnnotationType()
getAnnotationType
in class AbstractAnnotationConfigSupport
EnableSecurity
Annotation
Class
type.EnableSecurity
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
BeanFactory
.setBeanFactory
in interface BeanFactoryAware
setBeanFactory
in class AbstractAnnotationConfigSupport
beanFactory
- reference to the Spring BeanFactory
.IllegalArgumentException
- if the Spring BeanFactory
is not
an instance of ListableBeanFactory
.BeansException
BeanFactory
protected ListableBeanFactory getListableBeanFactory()
BeanFactory
.BeanFactory
.IllegalStateException
- if the Spring BeanFactory
was not set.BeanFactory
@Bean public BeanFactoryPostProcessor shiroGemFireBeanFactoryPostProcessor()
@Bean public BeanPostProcessor shiroLifecycleBeanPostProcessor()
Bean
definition to define, configure and register an Apache Shiro Spring
LifecycleBeanPostProcessor
to automatically call lifecycle callback methods
on Shiro security components during Spring container initialization and destruction phases.LifecycleBeanPostProcessor
to handle the lifecycle
of Apache Shiro security framework components.LifecycleBeanPostProcessor
@Bean public org.apache.shiro.mgt.SecurityManager shiroSecurityManager()
Bean
definition to define, configure and register an Apache Shiro
SecurityManager
implementation to secure Apache Geode.
The registration of this Bean
definition is dependent upon whether the user is using Apache Shiro
to secure Apache Geode, which is determined by the presence of Apache Shiro Realms
declared in the Spring ApplicationContext
.
This Bean
definition declares a dependency on the Apache Geode GemFireCache
instance
in order to ensure the Apache Geode cache is created and initialized first. This ensures that any internal
Apache Geode security configuration logic is evaluated and processed before SDG attempts to configure
Apache Shiro as Apache Geode's security provider.
Additionally, this Bean
definition will register the Apache Shiro
SecurityManager
with the Apache Shiro security framework
Finally, this method proceeds to enable Apache Geode security.SecurityManager
implementation used to secure Apache Geode.IllegalStateException
- if an Apache Shiro SecurityManager
was registered
with the Apache Shiro security framework but Apache Geode security could not be enabled.SecurityManager
,
registerSecurityManager(org.apache.shiro.mgt.SecurityManager)
,
resolveRealms()
protected List<org.apache.shiro.realm.Realm> resolveRealms()
Realms
declared and configured as Spring managed beans
in the Spring ApplicationContext
.
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.List
of all Apache Shiro Realms
declared and configured as Spring managed beans
in the Spring ApplicationContext
.ListableBeanFactory.getBeansOfType(Class, boolean, boolean)
,
OrderComparator
,
Realm
protected org.apache.shiro.mgt.SecurityManager registerSecurityManager(org.apache.shiro.mgt.SecurityManager securityManager)
SecurityManager
with the Apache Shiro
security framework.securityManager
- SecurityManager
to register.SecurityManager
reference.IllegalArgumentException
- if SecurityManager
is null.SecurityUtils.setSecurityManager(org.apache.shiro.mgt.SecurityManager)
,
SecurityManager
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.