@Configuration @Conditional(value=ApacheShiroSecurityConfiguration.ApacheShiroPresentCondition.class) public class ApacheShiroSecurityConfiguration extends Object implements BeanFactoryAware
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
,
BeanFactoryAware
,
ListableBeanFactory
,
Bean
,
Condition
,
Conditional
,
Configuration
,
ApacheShiroSecurityConfiguration.ApacheShiroPresentCondition
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. |
Constructor and Description |
---|
ApacheShiroSecurityConfiguration() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
enableApacheGeodeSecurity()
Sets the Apache Geode, Integrated Security
SecurityService property isIntegratedSecurity
to true to indicate that Apache Geode security is enabled. |
protected ListableBeanFactory |
getBeanFactory()
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) |
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(org.apache.geode.cache.GemFireCache gemfireCache)
Bean definition to define, configure and register an Apache Shiro
SecurityManager implementation to secure Apache Geode. |
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
protected ListableBeanFactory getBeanFactory()
BeanFactory
.BeanFactory
.IllegalStateException
- if the Spring BeanFactory
was not properly initialized.BeanFactory
@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(org.apache.geode.cache.GemFireCache gemfireCache)
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 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, 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)
,
enableApacheGeodeSecurity()
,
resolveRealms()
,
registerSecurityManager(org.apache.shiro.mgt.SecurityManager)
,
enableApacheGeodeSecurity()
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
protected boolean enableApacheGeodeSecurity()
SecurityService
property isIntegratedSecurity
to true to indicate that Apache Geode security is enabled.SecurityService.getSecurityService()
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.