1
0
forked from baron/baron-sso

fix: 세션 토큰 필드명 불일치 및 URL 파싱 오류(auth_handler) 수정 #239

This commit is contained in:
2026-02-11 14:23:20 +09:00
parent 474c8971a7
commit eee482197c

View File

@@ -1594,12 +1594,12 @@ func (h *AuthHandler) PasswordLogin(c *fiber.Ctx) error {
// --- OIDC 로그인 흐름 처리 끝 --- // --- OIDC 로그인 흐름 처리 끝 ---
resp := fiber.Map{ resp := fiber.Map{
"sessionJwt": authInfo.SessionToken.JWT, "sessionToken": authInfo.SessionToken.JWT,
"status": "ok", "status": "ok",
"provider": h.IdpProvider.Name(), "provider": h.IdpProvider.Name(),
} }
if authInfo.RefreshToken != nil { if authInfo.RefreshToken != nil {
resp["refreshJwt"] = authInfo.RefreshToken.JWT resp["refreshToken"] = authInfo.RefreshToken.JWT
} }
if authInfo.Subject != "" { if authInfo.Subject != "" {
resp["subject"] = authInfo.Subject resp["subject"] = authInfo.Subject
@@ -4789,10 +4789,7 @@ func extractLoginIDFromClaims(claims map[string]any) string {
} }
func (h *AuthHandler) getKratosIdentity(sessionToken string) (string, map[string]interface{}, error) { func (h *AuthHandler) getKratosIdentity(sessionToken string) (string, map[string]interface{}, error) {
kratosURL := strings.TrimRight(os.Getenv("KRATOS_PUBLIC_URL"), "/") kratosURL := strings.TrimRight(utils.GetEnv("KRATOS_PUBLIC_URL", "http://kratos:4433"), "/")
if kratosURL == "" {
kratosURL = "http://kratos:4433"
}
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, kratosURL+"/sessions/whoami", nil) req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, kratosURL+"/sessions/whoami", nil)
if err != nil { if err != nil {
return "", nil, err return "", nil, err
@@ -4823,10 +4820,7 @@ func (h *AuthHandler) getKratosIdentity(sessionToken string) (string, map[string
} }
func (h *AuthHandler) getKratosSessionID(sessionToken string) (string, error) { func (h *AuthHandler) getKratosSessionID(sessionToken string) (string, error) {
kratosURL := strings.TrimRight(os.Getenv("KRATOS_PUBLIC_URL"), "/") kratosURL := strings.TrimRight(utils.GetEnv("KRATOS_PUBLIC_URL", "http://kratos:4433"), "/")
if kratosURL == "" {
kratosURL = "http://kratos:4433"
}
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, kratosURL+"/sessions/whoami", nil) req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, kratosURL+"/sessions/whoami", nil)
if err != nil { if err != nil {
return "", err return "", err
@@ -4849,6 +4843,7 @@ func (h *AuthHandler) getKratosSessionID(sessionToken string) (string, error) {
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return "", err return "", err
} }
return result.ID, nil return result.ID, nil
} }
@@ -4857,10 +4852,7 @@ func (h *AuthHandler) issueKratosSession(ctx context.Context, identityID string)
return "", fmt.Errorf("kratos identity id is empty") return "", fmt.Errorf("kratos identity id is empty")
} }
kratosAdminURL := strings.TrimRight(os.Getenv("KRATOS_ADMIN_URL"), "/") kratosAdminURL := strings.TrimRight(utils.GetEnv("KRATOS_ADMIN_URL", "http://kratos:4434"), "/")
if kratosAdminURL == "" {
kratosAdminURL = "http://kratos:4434"
}
payload := map[string]interface{}{ payload := map[string]interface{}{
"identity_id": identityID, "identity_id": identityID,