Search in sources :

Example 1 with CookieRememberMeManager

use of org.apache.shiro.web.mgt.CookieRememberMeManager 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)

Example 2 with CookieRememberMeManager

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

the class ShiroEnvStarter method createRememberMeManager.

@IocBean(name = "shiroRememberMeManager")
public RememberMeManager createRememberMeManager() {
    CookieRememberMeManager rememberMeManager = new CookieRememberMeManager();
    rememberMeManager.setSerializer(new SimplePrincipalSerializer());
    SimpleCookie cookie = new SimpleCookie();
    cookie.setName("rememberMe");
    cookie.setHttpOnly(true);
    rememberMeManager.setCookie(cookie);
    return rememberMeManager;
}
Also used : SimpleCookie(org.apache.shiro.web.servlet.SimpleCookie) SimplePrincipalSerializer(org.nutz.integration.shiro.SimplePrincipalSerializer) CookieRememberMeManager(org.apache.shiro.web.mgt.CookieRememberMeManager) IocBean(org.nutz.ioc.loader.annotation.IocBean)

Example 3 with CookieRememberMeManager

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

the class ShiroConfig method rememberMeManager.

/**
 * rememberMe管理器, cipherKey生成见{@code Base64Test.java}
 */
@Bean
public CookieRememberMeManager rememberMeManager(SimpleCookie rememberMeCookie) {
    CookieRememberMeManager manager = new CookieRememberMeManager();
    manager.setCipherKey(Base64.decode("Z3VucwAAAAAAAAAAAAAAAA=="));
    manager.setCookie(rememberMeCookie);
    return manager;
}
Also used : CookieRememberMeManager(org.apache.shiro.web.mgt.CookieRememberMeManager) ShiroFilterFactoryBean(org.apache.shiro.spring.web.ShiroFilterFactoryBean) MethodInvokingFactoryBean(org.springframework.beans.factory.config.MethodInvokingFactoryBean) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with CookieRememberMeManager

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

the class ShiroConfig method rememberMeManager.

/**
 * @方法描述 : rememberMe管理器
 * @param rememberMeCookie
 * @return
 */
// @Bean
public CookieRememberMeManager rememberMeManager() {
    CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
    cookieRememberMeManager.setCookie(rememberMeCookie());
    // cookieRememberMeManager.setCipherKey();
    return cookieRememberMeManager;
}
Also used : CookieRememberMeManager(org.apache.shiro.web.mgt.CookieRememberMeManager)

Example 5 with CookieRememberMeManager

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

the class ShiroConfiguration method rememberMeManager.

/**
 * cookie管理对象;
 * @return
 */
@Bean
public CookieRememberMeManager rememberMeManager() {
    System.out.println("ShiroConfiguration.rememberMeManager()");
    CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
    cookieRememberMeManager.setCookie(rememberMeCookie());
    return cookieRememberMeManager;
}
Also used : CookieRememberMeManager(org.apache.shiro.web.mgt.CookieRememberMeManager) ShiroFilterFactoryBean(org.apache.shiro.spring.web.ShiroFilterFactoryBean) Bean(org.springframework.context.annotation.Bean)

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