From 6b41922408dea0e31607916c20c0026cc3c501a5 Mon Sep 17 00:00:00 2001
From: zrj <646384940@qq.com>
Date: Wed, 05 Jun 2024 09:37:35 +0800
Subject: [PATCH] 鉴权开启及其他配置调整
---
blade-auth/src/main/java/org/springblade/auth/config/CustomAuthenticationSuccessHandler.java | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/blade-auth/src/main/java/org/springblade/auth/config/CustomAuthenticationSuccessHandler.java b/blade-auth/src/main/java/org/springblade/auth/config/CustomAuthenticationSuccessHandler.java
index 8be99a0..b22ef33 100644
--- a/blade-auth/src/main/java/org/springblade/auth/config/CustomAuthenticationSuccessHandler.java
+++ b/blade-auth/src/main/java/org/springblade/auth/config/CustomAuthenticationSuccessHandler.java
@@ -5,12 +5,17 @@
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Map;
+
+import static org.springframework.security.web.context.HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY;
public class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
private String redirectUrl;
+
+ private String springSecurityContextKey = SPRING_SECURITY_CONTEXT_KEY;
public CustomAuthenticationSuccessHandler(String redirectUrl) {
this.redirectUrl = redirectUrl;
@@ -18,7 +23,13 @@
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
-// String requestURI = request.getRequestURI();
+ // 获取session
+// HttpSession session = request.getSession();
+ // 从authentication中获取principal信息
+// Object principal = authentication.getPrincipal();
+ // 将principal信息存入session
+// session.setAttribute(this.springSecurityContextKey, principal);
+ // String requestURI = request.getRequestURI();
Map<String, String[]> parameterMap = request.getParameterMap();
StringBuilder builder = new StringBuilder();
if (parameterMap.size()>0){
--
Gitblit v1.9.3