123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- package com.usky.config;
- import lombok.Data;
- import org.springframework.boot.context.properties.ConfigurationProperties;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.stereotype.Component;
- /**
- * @author laowo
- * @version v1.0
- * @date 2021/8/19 17:24
- * @description TODO
- **/
- @Data
- @ConfigurationProperties(prefix = "shiro")
- @Component
- public class ShiroProperties {
- /**
- * shiro 常规设置
- */
- private User user = new User();
- /**
- * cookie设置
- */
- private Cookie cookie = new Cookie();
- /**
- * session设置
- */
- private Session session = new Session();
- @Data
- public static class User {
- /**
- * 登录地址
- */
- private String loginUrl;
- /**
- * 权限认证失败地址
- */
- private String unauthorizedUrl;
- /**
- * 首页地址
- */
- private String indexUrl;
- /**
- * 验证码开关
- */
- private Boolean captchaEnabled;
- /**
- * 验证码类型
- */
- private String captchaType;
- }
- @Data
- public static class Cookie {
- /**
- * # 设置Cookie的域名 默认空,即当前访问的域名
- */
- private String domain;
- /**
- * 设置cookie的有效访问路径
- */
- private String path;
- /**
- * 设置HttpOnly属性
- */
- private Boolean httpOnly;
- /**
- * 设置Cookie的过期时间,天为单位
- */
- private int maxAge;
- /**
- * cipherKey
- */
- private String cipherKey;
- }
- @Data
- static class Session {
- /**
- * Session超时时间,-1代表永不过期(默认30分钟)
- */
- private int expireTime;
- /**
- * 同步session到数据库的周期(默认1分钟)
- */
- private int dbSyncPeriod;
- /**
- * 相隔多久检查一次session的有效性,默认就是10分钟
- */
- private int validationInterval;
- /**
- * 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制)
- */
- private int maxSession;
- /**
- * 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
- */
- private boolean kickoutAfter;
- }
- }
|