Java Code Examples for org.apache.shiro.web.servlet.SimpleCookie#setMaxAge()

The following examples show how to use org.apache.shiro.web.servlet.SimpleCookie#setMaxAge() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShiroConfig.java    From kvf-admin with MIT License 5 votes vote down vote up
/**
 * Cookie对象
 * @return simpleCookie
 */
private SimpleCookie rememberMeCookie() {
    SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
    // 记住时间,单位秒,默认15天
    simpleCookie.setMaxAge(60 * 60 * 24 * 15);
    return simpleCookie;
}
 
Example 2
Source File: ShiroConfig.java    From mysiteforme with Apache License 2.0 5 votes vote down vote up
@Bean
public SimpleCookie rememberMeCookie(){
    //这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
    SimpleCookie cookie = new SimpleCookie("rememberMe");
    cookie.setHttpOnly(true);
    //记住我有效期长达30天
    cookie.setMaxAge(2592000);
    return cookie;
}
 
Example 3
Source File: ShiroConfig.java    From LuckyFrameWeb with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * cookie 属性设置
 */
public SimpleCookie rememberMeCookie()
{
    SimpleCookie cookie = new SimpleCookie("rememberMe");
    cookie.setDomain(domain);
    cookie.setPath(path);
    cookie.setHttpOnly(httpOnly);
    cookie.setMaxAge(maxAge * 24 * 60 * 60);
    return cookie;
}
 
Example 4
Source File: ShiroConfig.java    From SpringBoot-Base-System with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 产生cookie
 */
@Bean
@ConditionalOnMissingBean
public SimpleCookie rememberMeCookie() {

	log.info("ShiroConfiguration.rememberMeCookie()");
	// 这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
	SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
	// <!-- 记住我cookie生效时间30天 ,单位秒;-->
	simpleCookie.setMaxAge(2592000);
	simpleCookie.setComment("my cookie comment");
	return simpleCookie;
}
 
Example 5
Source File: ShiroConfig.java    From SpringBootBucket with MIT License 5 votes vote down vote up
/**
 * cookie对象;
 *
 * @return
 */
@Bean
public SimpleCookie rememberMeCookie() {
    //System.out.println("ShiroConfiguration.rememberMeCookie()");
    //这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
    SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
    //<!-- 记住我cookie生效时间30天 ,单位秒;-->
    simpleCookie.setMaxAge(259200);
    return simpleCookie;
}
 
Example 6
Source File: ShiroConfiguration.java    From spring-boot-seed with MIT License 5 votes vote down vote up
/**
 * rememberMeCookie: 记住自己的cookie
 *
 * @return SimpleCookie
 */
@Bean
public SimpleCookie rememberMeCookie() {
    //这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
    SimpleCookie simpleCookie = new SimpleCookie(CookieEnum.REMEMBER_ME.getValue());
    //记住我cookie生效时间30天 ,单位秒;
    simpleCookie.setMaxAge(259200);
    return simpleCookie;
}
 
Example 7
Source File: ShiroConfig.java    From springboot-shiro with MIT License 5 votes vote down vote up
/**
 * cookie对象;
 *
 * @return
 */
public SimpleCookie rememberMeCookie() {
    // 这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
    SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
    // 记住我cookie生效时间30天 ,单位秒。 注释掉,默认永久不过期 2018-07-15
    simpleCookie.setMaxAge(redisProperties.getExpire());
    return simpleCookie;
}
 
Example 8
Source File: ShiroConfig.java    From OneBlog with GNU General Public License v3.0 5 votes vote down vote up
/**
 * cookie对象;
 *
 * @return
 */
public SimpleCookie rememberMeCookie() {
    // 这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
    SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
    // 记住我cookie生效时间30天 ,单位秒。 注释掉,默认永久不过期 2018-07-15
    simpleCookie.setMaxAge(redisProperties.getExpire());
    return simpleCookie;
}
 
Example 9
Source File: ShiroConfig.java    From springboot-learn with MIT License 5 votes vote down vote up
/**
 * cookie 属性设置
 */
public SimpleCookie rememberMeCookie() {
    SimpleCookie cookie = new SimpleCookie("rememberMe");
    cookie.setDomain("");
    cookie.setPath("/");
    cookie.setHttpOnly(true);
    cookie.setMaxAge(30 * 24 * 60 * 60);
    return cookie;
}
 
Example 10
Source File: ShiroConfig.java    From pybbs with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean
@DependsOn("mybatisPlusConfig")
public SimpleCookie rememberMeCookie() {
    //这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
    SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
    // 记住我cookie生效时间 单位秒
    int adminRememberMeMaxAge = Integer.parseInt(systemConfigService.selectAllConfig().get
            ("admin_remember_me_max_age").toString());
    simpleCookie.setMaxAge(adminRememberMeMaxAge * 24 * 60 * 60);
    return simpleCookie;
}
 
Example 11
Source File: ShiroConfig.java    From WebStack-Guns with MIT License 5 votes vote down vote up
/**
 * 记住密码Cookie
 */
@Bean
public SimpleCookie rememberMeCookie() {
    SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
    simpleCookie.setHttpOnly(true);
    simpleCookie.setMaxAge(7 * 24 * 60 * 60);//7天
    return simpleCookie;
}
 
Example 12
Source File: ShiroConfig.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * cookie 属性设置
 */
public SimpleCookie rememberMeCookie()
{
    SimpleCookie cookie = new SimpleCookie("rememberMe");
    cookie.setDomain(domain);
    cookie.setPath(path);
    cookie.setHttpOnly(httpOnly);
    cookie.setMaxAge(maxAge * 24 * 60 * 60);
    return cookie;
}
 
Example 13
Source File: ShiroConfiguration.java    From wangmarket with Apache License 2.0 5 votes vote down vote up
/**
 * cookie对象;
 * @return
 */
public SimpleCookie rememberMeCookie(){
   //这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
   SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
   //<!-- 记住我cookie生效时间30天 ,单位秒;-->
   simpleCookie.setMaxAge(2592000);
   return simpleCookie;
}
 
Example 14
Source File: ShiroConfig.java    From SpringAll with MIT License 5 votes vote down vote up
/**
 * cookie对象
 * @return
 */
public SimpleCookie rememberMeCookie() {
	// 设置cookie名称,对应login.html页面的<input type="checkbox" name="rememberMe"/>
	SimpleCookie cookie = new SimpleCookie("rememberMe");
	// 设置cookie的过期时间,单位为秒,这里为一天
	cookie.setMaxAge(86400);
	return cookie;
}
 
Example 15
Source File: ShiroConfig.java    From ElementVueSpringbootCodeTemplate with Apache License 2.0 5 votes vote down vote up
/**
 * cookie对象;
 *
 * @return
 */
public SimpleCookie rememberMeCookie() {
    // 这个参数是cookie的名称,对应前端的checkbox 的name = rememberMe
    SimpleCookie simpleCookie = new SimpleCookie("rememberMe");

    // <!-- 记住我cookie生效时间30天(259200) ,单位秒;-->
    simpleCookie.setMaxAge(259200);

    return simpleCookie;
}
 
Example 16
Source File: ShiroConfig.java    From erp-framework with MIT License 5 votes vote down vote up
/**
 * cookie对象,通过登录界面的记住我
 * @return
 */
@Bean
public SimpleCookie rememberMeCookie(){
    //这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
    SimpleCookie cookie = new SimpleCookie("rememberMe");

    //setcookie的httponly属性如果设为true的话,会增加对xss防护的安全系数。它有以下特点:
    //setcookie()的第七个参数
    //设为true后,只能通过http访问,javascript无法访问
    //防止xss读取cookie
    cookie.setHttpOnly(true);
    //记住我有效期长达30天
    cookie.setMaxAge(2592000);
    return cookie;
}
 
Example 17
Source File: ShiroConfig.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * cookie 属性设置
 */
public SimpleCookie rememberMeCookie()
{
    SimpleCookie cookie = new SimpleCookie("rememberMe");
    cookie.setDomain(domain);
    cookie.setPath(path);
    cookie.setHttpOnly(httpOnly);
    cookie.setMaxAge(maxAge * 24 * 60 * 60);
    return cookie;
}
 
Example 18
Source File: ShiroConfig.java    From SpringAll with MIT License 4 votes vote down vote up
public SimpleCookie rememberMeCookie() {
	SimpleCookie cookie = new SimpleCookie("rememberMe");
	cookie.setMaxAge(86400);
	return cookie;
}
 
Example 19
Source File: ShiroConfig.java    From SpringAll with MIT License 4 votes vote down vote up
public SimpleCookie rememberMeCookie() {
	SimpleCookie cookie = new SimpleCookie("rememberMe");
	cookie.setMaxAge(86400);
	return cookie;
}
 
Example 20
Source File: ShiroConfig.java    From SpringAll with MIT License 4 votes vote down vote up
public SimpleCookie rememberMeCookie() {
	SimpleCookie cookie = new SimpleCookie("rememberMe");
	cookie.setMaxAge(86400);
	return cookie;
}