From 1e46c2f3523f0f73a7ed378e9281dec24b23f8f8 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Mon, 23 Jun 2025 12:56:54 +0000
Subject: (김준회) SAML 2.0 relay-state 처리 및 redirect 상태코드 문제 디버깅
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/login/saml-login-button.tsx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'components/login/saml-login-button.tsx')

diff --git a/components/login/saml-login-button.tsx b/components/login/saml-login-button.tsx
index c0aae0f1..02825e2f 100644
--- a/components/login/saml-login-button.tsx
+++ b/components/login/saml-login-button.tsx
@@ -32,8 +32,14 @@ export function SAMLLoginButton({
     try {
       setIsLoading(true)
 
+      // 현재 페이지 경로를 RelayState로 설정 (로그인 후 이 페이지로 돌아옴)
+      const currentPath = window.location.pathname + window.location.search
+      const relayState = encodeURIComponent(currentPath)
+      
+      console.log('Setting RelayState to:', currentPath)
+
       // API 엔드포인트를 통해 SAML AuthnRequest URL 생성
-      const response = await fetch('/api/auth/saml/authn-request', {
+      const response = await fetch(`/api/auth/saml/authn-request?relayState=${relayState}`, {
         method: 'GET',
         headers: {
           'Content-Type': 'application/json',
-- 
cgit v1.2.3

