Search in sources :

Example 6 with CookieRememberMeManager

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

the class SampleShiroServletModule 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)

Example 7 with CookieRememberMeManager

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

the class AbstractShiroWebConfiguration method rememberMeManager.

protected RememberMeManager rememberMeManager() {
    CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
    cookieRememberMeManager.setCookie(rememberMeCookieTemplate());
    return cookieRememberMeManager;
}
Also used : CookieRememberMeManager(org.apache.shiro.web.mgt.CookieRememberMeManager)

Aggregations

CookieRememberMeManager (org.apache.shiro.web.mgt.CookieRememberMeManager)7 MalformedURLException (java.net.MalformedURLException)2 ConfigurationException (org.apache.shiro.config.ConfigurationException)2 ShiroFilterFactoryBean (org.apache.shiro.spring.web.ShiroFilterFactoryBean)2 DefaultWebSecurityManager (org.apache.shiro.web.mgt.DefaultWebSecurityManager)2 Bean (org.springframework.context.annotation.Bean)2 SimpleCookie (org.apache.shiro.web.servlet.SimpleCookie)1 SimplePrincipalSerializer (org.nutz.integration.shiro.SimplePrincipalSerializer)1 IocBean (org.nutz.ioc.loader.annotation.IocBean)1 MethodInvokingFactoryBean (org.springframework.beans.factory.config.MethodInvokingFactoryBean)1 EhCacheManagerFactoryBean (org.springframework.cache.ehcache.EhCacheManagerFactoryBean)1