summaryrefslogtreecommitdiff
path: root/app/api/saml/callback/route.ts
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-06-23 13:31:14 +0000
committerjoonhoekim <26rote@gmail.com>2025-06-23 13:31:14 +0000
commitf4825dd3853188de4688fb4a56c0f4e847da314b (patch)
treed4a46cac8545af78f48b1c960576a9b2d65ce37a /app/api/saml/callback/route.ts
parent1e46c2f3523f0f73a7ed378e9281dec24b23f8f8 (diff)
(김준회) SAML 2.0 SSO 처리 - HTTP / HTTPS 대응 처리
Diffstat (limited to 'app/api/saml/callback/route.ts')
-rw-r--r--app/api/saml/callback/route.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/api/saml/callback/route.ts b/app/api/saml/callback/route.ts
index 7f454cb9..c0290e71 100644
--- a/app/api/saml/callback/route.ts
+++ b/app/api/saml/callback/route.ts
@@ -161,9 +161,12 @@ export async function POST(request: NextRequest) {
// POST 요청에 대한 응답으로는 303 See Other를 사용하여 GET으로 강제 변환
const response = NextResponse.redirect(new URL(redirectPath, baseUrl), 303)
+ // NEXTAUTH_URL이 HTTPS인 경우에만 secure 쿠키 사용
+ const isHttps = baseUrl.startsWith('https://');
+
response.cookies.set(cookieName, encodedToken, {
httpOnly: true,
- secure: process.env.NODE_ENV === 'production',
+ secure: isHttps,
sameSite: 'lax',
path: '/',
maxAge: 30 * 24 * 60 * 60 // 30일