ShiroProperties.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package com.usky.config;
  2. import lombok.Data;
  3. import org.springframework.boot.context.properties.ConfigurationProperties;
  4. import org.springframework.context.annotation.Configuration;
  5. import org.springframework.stereotype.Component;
  6. /**
  7. * @author laowo
  8. * @version v1.0
  9. * @date 2021/8/19 17:24
  10. * @description TODO
  11. **/
  12. @Data
  13. @ConfigurationProperties(prefix = "shiro")
  14. @Component
  15. public class ShiroProperties {
  16. /**
  17. * shiro 常规设置
  18. */
  19. private User user = new User();
  20. /**
  21. * cookie设置
  22. */
  23. private Cookie cookie = new Cookie();
  24. /**
  25. * session设置
  26. */
  27. private Session session = new Session();
  28. @Data
  29. public static class User {
  30. /**
  31. * 登录地址
  32. */
  33. private String loginUrl;
  34. /**
  35. * 权限认证失败地址
  36. */
  37. private String unauthorizedUrl;
  38. /**
  39. * 首页地址
  40. */
  41. private String indexUrl;
  42. /**
  43. * 验证码开关
  44. */
  45. private Boolean captchaEnabled;
  46. /**
  47. * 验证码类型
  48. */
  49. private String captchaType;
  50. }
  51. @Data
  52. public static class Cookie {
  53. /**
  54. * # 设置Cookie的域名 默认空,即当前访问的域名
  55. */
  56. private String domain;
  57. /**
  58. * 设置cookie的有效访问路径
  59. */
  60. private String path;
  61. /**
  62. * 设置HttpOnly属性
  63. */
  64. private Boolean httpOnly;
  65. /**
  66. * 设置Cookie的过期时间,天为单位
  67. */
  68. private int maxAge;
  69. /**
  70. * cipherKey
  71. */
  72. private String cipherKey;
  73. }
  74. @Data
  75. static class Session {
  76. /**
  77. * Session超时时间,-1代表永不过期(默认30分钟)
  78. */
  79. private int expireTime;
  80. /**
  81. * 同步session到数据库的周期(默认1分钟)
  82. */
  83. private int dbSyncPeriod;
  84. /**
  85. * 相隔多久检查一次session的有效性,默认就是10分钟
  86. */
  87. private int validationInterval;
  88. /**
  89. * 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制)
  90. */
  91. private int maxSession;
  92. /**
  93. * 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
  94. */
  95. private boolean kickoutAfter;
  96. }
  97. }