|
@@ -0,0 +1,29 @@
|
|
|
+package com.rtrh.projects.config;
|
|
|
+
|
|
|
+import org.apache.shiro.mgt.RememberMeManager;
|
|
|
+import org.apache.shiro.web.mgt.CookieRememberMeManager;
|
|
|
+import org.apache.shiro.web.servlet.SimpleCookie;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+
|
|
|
+import java.util.Base64;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author dupengcheng
|
|
|
+ * @date 2025/3/4
|
|
|
+ * @apiNote
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+public class RememberConfig {
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public RememberMeManager rememberMeManager(){
|
|
|
+ CookieRememberMeManager rememberMeManager = new CookieRememberMeManager();
|
|
|
+ SimpleCookie simpleCookie = new SimpleCookie();
|
|
|
+ simpleCookie.setHttpOnly(true);
|
|
|
+ simpleCookie.setMaxAge(604800);
|
|
|
+ rememberMeManager.setCookie(simpleCookie);
|
|
|
+ rememberMeManager.setCipherKey(Base64.getDecoder().decode("6ZmI6I2j3Y+R1aSn5BOlAA=="));
|
|
|
+ return rememberMeManager;
|
|
|
+ }
|
|
|
+}
|