summaryrefslogtreecommitdiff
path: root/app/api/saml
diff options
context:
space:
mode:
Diffstat (limited to 'app/api/saml')
-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일