summaryrefslogtreecommitdiff
path: root/app/api/auth
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/auth
parent1e46c2f3523f0f73a7ed378e9281dec24b23f8f8 (diff)
(김준회) SAML 2.0 SSO 처리 - HTTP / HTTPS 대응 처리
Diffstat (limited to 'app/api/auth')
-rw-r--r--app/api/auth/[...nextauth]/saml/provider.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/api/auth/[...nextauth]/saml/provider.ts b/app/api/auth/[...nextauth]/saml/provider.ts
index 1f891661..8486a690 100644
--- a/app/api/auth/[...nextauth]/saml/provider.ts
+++ b/app/api/auth/[...nextauth]/saml/provider.ts
@@ -248,7 +248,11 @@ export async function createNextAuthToken(user: User): Promise<string> {
// NextAuth 세션 쿠키 이름 가져오기
export function getSessionCookieName(): string {
- return process.env.NODE_ENV === 'production'
+ // NEXTAUTH_URL이 HTTPS인 경우에만 __Secure- 접두사 사용
+ const nextAuthUrl = process.env.NEXTAUTH_URL || '';
+ const isHttps = nextAuthUrl.startsWith('https://');
+
+ return isHttps
? '__Secure-next-auth.session-token'
: 'next-auth.session-token';
}