Search in sources :

Example 1 with DefaultWebSecurityManager

use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project Ganster-CMS by Gangster-trio.

the class ShiroConfig method securityManager.

@Bean(name = "securityManager")
public SecurityManager securityManager() {
    DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
    // 设置realm
    securityManager.setRealm(shiroRealm());
    return securityManager;
}
Also used : DefaultWebSecurityManager(org.apache.shiro.web.mgt.DefaultWebSecurityManager) ShiroFilterFactoryBean(org.apache.shiro.spring.web.ShiroFilterFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with DefaultWebSecurityManager

use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project moon by gentoo111.

the class ShiroConfig method securityManager.

@Bean
public SecurityManager securityManager(EhCacheManager cacheManager) {
    DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
    securityManager.setRealm(myShiroRealm());
    securityManager.setCacheManager(cacheManager);
    return securityManager;
}
Also used : DefaultWebSecurityManager(org.apache.shiro.web.mgt.DefaultWebSecurityManager) ShiroFilterFactoryBean(org.apache.shiro.spring.web.ShiroFilterFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with DefaultWebSecurityManager

use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project springBoot-learn-demo by nbfujx.

the class ShiroConfig method securityManager.

/**
 * SecurityManager,权限管理,这个类组合了登陆,登出,权限,session的处理,是个比较重要的类。
 */
@Bean(name = "securityManager")
public DefaultWebSecurityManager securityManager() {
    DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
    securityManager.setRealm(shiroRealm());
    securityManager.setCacheManager(redisCacheManager());
    securityManager.setSessionManager(sessionManager());
    return securityManager;
}
Also used : DefaultWebSecurityManager(org.apache.shiro.web.mgt.DefaultWebSecurityManager) ShiroFilterFactoryBean(org.apache.shiro.spring.web.ShiroFilterFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with DefaultWebSecurityManager

use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project Spring-Family by Sierou-Java.

the class ShiroConfiguration method securityManager.

// /////////////////////////////////////记住我 END/////////////////////////////////////
@Bean
public SecurityManager securityManager() {
    DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
    // 设置realm.
    securityManager.setRealm(myShiroRealm());
    // 注入缓存管理器;
    // 这个如果执行多次,也是同样的一个对象;
    securityManager.setCacheManager(ehCacheManager());
    // 注入记住我管理器;
    securityManager.setRememberMeManager(rememberMeManager());
    return securityManager;
}
Also used : DefaultWebSecurityManager(org.apache.shiro.web.mgt.DefaultWebSecurityManager) ShiroFilterFactoryBean(org.apache.shiro.spring.web.ShiroFilterFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 5 with DefaultWebSecurityManager

use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project shiro by apache.

the class SampleShiroNativeSessionsServletModule method bindWebSecurityManager.

@Override
protected void bindWebSecurityManager(AnnotatedBindingBuilder<? super WebSecurityManager> bind) {
    try {
        String cipherKey = loadShiroIni().getSectionProperty("main", "securityManager.rememberMeManager.cipherKey");
        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
        CookieRememberMeManager rememberMeManager = new CookieRememberMeManager();
        rememberMeManager.setCipherKey(Base64.decode(cipherKey));
        securityManager.setRememberMeManager(rememberMeManager);
        bind.toInstance(securityManager);
    } catch (MalformedURLException e) {
        // super.bindWebSecurityManager(bind) if you do not need rememberMe functionality
        throw new ConfigurationException("securityManager.rememberMeManager.cipherKey must be set in shiro.ini.");
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ConfigurationException(org.apache.shiro.config.ConfigurationException) DefaultWebSecurityManager(org.apache.shiro.web.mgt.DefaultWebSecurityManager) CookieRememberMeManager(org.apache.shiro.web.mgt.CookieRememberMeManager)

Aggregations

DefaultWebSecurityManager (org.apache.shiro.web.mgt.DefaultWebSecurityManager)24 Bean (org.springframework.context.annotation.Bean)11 ShiroFilterFactoryBean (org.apache.shiro.spring.web.ShiroFilterFactoryBean)10 Realm (org.apache.shiro.realm.Realm)7 IniRealm (org.apache.shiro.realm.text.IniRealm)3 CookieRememberMeManager (org.apache.shiro.web.mgt.CookieRememberMeManager)3 MalformedURLException (java.net.MalformedURLException)2 ConfigurationException (org.apache.shiro.config.ConfigurationException)2 WebSecurityManager (org.apache.shiro.web.mgt.WebSecurityManager)2 DefaultWebSessionManager (org.apache.shiro.web.session.mgt.DefaultWebSessionManager)2 LdapRealm (org.apache.zeppelin.realm.LdapRealm)2 Test (org.junit.Test)2 ImmutableList (com.google.common.collect.ImmutableList)1 Injector (com.google.inject.Injector)1 Provides (com.google.inject.Provides)1 ArrayList (java.util.ArrayList)1 Filter (javax.servlet.Filter)1 ServletContext (javax.servlet.ServletContext)1 Cookie (javax.servlet.http.Cookie)1 Ini (org.apache.shiro.config.Ini)1