forked from baron/baron-sso
Baron 통합로그인 -> Baron 로그인 명칭 변경
This commit is contained in:
@@ -237,7 +237,7 @@ func (h *AuthHandler) SendSignupEmailCode(c *fiber.Ctx) error {
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": "Email service not configured"})
|
||||
}
|
||||
|
||||
subject := "[Baron 통합로그인] 회원가입 인증코드"
|
||||
subject := "[Baron 로그인] 회원가입 인증코드"
|
||||
body := fmt.Sprintf(`
|
||||
<div style="padding: 20px; font-family: sans-serif;">
|
||||
<h2>이메일 인증</h2>
|
||||
@@ -287,7 +287,7 @@ func (h *AuthHandler) SendSignupSmsCode(c *fiber.Ctx) error {
|
||||
h.saveSignupState(key, newState, signupStateExpiration)
|
||||
|
||||
// 4. Send SMS
|
||||
content := fmt.Sprintf("[Baron 통합로그인] 인증번호 [%s]를 입력해주세요.", code)
|
||||
content := fmt.Sprintf("[Baron 로그인] 인증번호 [%s]를 입력해주세요.", code)
|
||||
go h.SmsService.SendSms(phone, content)
|
||||
|
||||
return c.JSON(fiber.Map{"message": "Verification code sent"})
|
||||
@@ -808,7 +808,7 @@ func (h *AuthHandler) SendSms(c *fiber.Ctx) error {
|
||||
sanitizedPhone := strings.ReplaceAll(req.PhoneNumber, "-", "")
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
code := fmt.Sprintf("%06d", rand.Intn(1000000))
|
||||
content := fmt.Sprintf("[Baron 통합로그인] 인증번호: %s", code)
|
||||
content := fmt.Sprintf("[Baron 로그인] 인증번호: %s", code)
|
||||
|
||||
h.RedisService.StoreVerificationCode(sanitizedPhone, code)
|
||||
if err := h.SmsService.SendSms(sanitizedPhone, content); err != nil {
|
||||
@@ -991,10 +991,10 @@ func (h *AuthHandler) InitEnchantedLink(c *fiber.Ctx) error {
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": "Email service not configured"})
|
||||
}
|
||||
|
||||
subject := "[Baron 통합로그인] 링크"
|
||||
subject := "[Baron 로그인] 링크"
|
||||
body := fmt.Sprintf(`
|
||||
<div style="font-family: sans-serif; padding: 20px; border: 1px solid #eee; border-radius: 10px; max-width: 500px;">
|
||||
<h2 style="color: #1A1F2C;">Baron SSO 로그인</h2>
|
||||
<h2 style="color: #1A1F2C;">Baron 로그인</h2>
|
||||
<p>안녕하세요,</p>
|
||||
<p>아래 버튼을 클릭하여 로그인을 완료해 주세요. 이 링크는 5분 동안 유효합니다.</p>
|
||||
<div style="margin: 30px 0;">
|
||||
@@ -1016,7 +1016,7 @@ func (h *AuthHandler) InitEnchantedLink(c *fiber.Ctx) error {
|
||||
}
|
||||
} else {
|
||||
// Send SMS
|
||||
content := fmt.Sprintf("[Baron 통합로그인] 로그인 링크: %s | 코드: %s", link, userCode)
|
||||
content := fmt.Sprintf("[Baron 로그인] 로그인 링크: %s | 코드: %s", link, userCode)
|
||||
if drySend {
|
||||
slog.Info("[Enchanted][DrySend] SMS send skipped", "loginID", loginID, "content", content)
|
||||
} else {
|
||||
@@ -1677,10 +1677,10 @@ func (h *AuthHandler) InitiatePasswordReset(c *fiber.Ctx) error {
|
||||
ale.Log(slog.LevelError, "Email service not configured")
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": "Email service not configured"})
|
||||
}
|
||||
subject := "[Baron 통합로그인] 비밀번호 재설정"
|
||||
subject := "[Baron 로그인] 비밀번호 재설정"
|
||||
body := fmt.Sprintf(`
|
||||
<div style="font-family: sans-serif; padding: 20px; border: 1px solid #eee; border-radius: 10px; max-width: 500px;">
|
||||
<h2 style="color: #1A1F2C;">Baron SSO 비밀번호 재설정</h2>
|
||||
<h2 style="color: #1A1F2C;">Baron 로그인 비밀번호 재설정</h2>
|
||||
<p>아래 버튼을 클릭해 비밀번호 재설정을 진행해 주세요. 링크는 15분간 유효합니다.</p>
|
||||
<div style="margin: 30px 0;">
|
||||
<a href="%s" style="background-color: #1A1F2C; color: white; padding: 12px 24px; text-decoration: none; border-radius: 5px; font-weight: bold;">비밀번호 재설정</a>
|
||||
@@ -1700,7 +1700,7 @@ func (h *AuthHandler) InitiatePasswordReset(c *fiber.Ctx) error {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
resetSms := fmt.Sprintf("[Baron 통합로그인] 비밀번호 재설정 링크: %s", resetLink)
|
||||
resetSms := fmt.Sprintf("[Baron 로그인] 비밀번호 재설정 링크: %s", resetLink)
|
||||
if drySend {
|
||||
ale.Log(slog.LevelInfo, "SMS send skipped (dry-send)", slog.String("loginId", loginID), slog.String("content", resetSms))
|
||||
} else {
|
||||
@@ -1736,7 +1736,7 @@ func (h *AuthHandler) VerifyPasswordResetPage(c *fiber.Ctx) error {
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Baron SSO - 비밀번호 재설정</title>
|
||||
<title>Baron 로그인 - 비밀번호 재설정</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
body { font-family: sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f5f5f5; }
|
||||
@@ -2227,7 +2227,7 @@ func (h *AuthHandler) buildKratosCourierMessage(req *kratosCourierRequest) (stri
|
||||
body := strings.TrimSpace(req.Body)
|
||||
if body != "" || subject != "" {
|
||||
if subject == "" {
|
||||
subject = "[Baron 통합로그인] 알림"
|
||||
subject = "[Baron 로그인] 알림"
|
||||
}
|
||||
return subject, body
|
||||
}
|
||||
@@ -2251,9 +2251,9 @@ func (h *AuthHandler) buildKratosCourierMessage(req *kratosCourierRequest) (stri
|
||||
|
||||
if subject == "" {
|
||||
if label == "알림" {
|
||||
subject = "[Baron 통합로그인] 알림"
|
||||
subject = "[Baron 로그인] 알림"
|
||||
} else {
|
||||
subject = fmt.Sprintf("[Baron 통합로그인] %s 코드", label)
|
||||
subject = fmt.Sprintf("[Baron 로그인] %s 코드", label)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2272,10 +2272,10 @@ func (h *AuthHandler) buildKratosCourierMessage(req *kratosCourierRequest) (stri
|
||||
}
|
||||
|
||||
if code == "" {
|
||||
return subject, fmt.Sprintf("[Baron 통합로그인] %s 요청이 도착했습니다", label)
|
||||
return subject, fmt.Sprintf("[Baron 로그인] %s 요청이 도착했습니다", label)
|
||||
}
|
||||
|
||||
message := fmt.Sprintf("[Baron 통합로그인] %s 코드: %s", label, code)
|
||||
message := fmt.Sprintf("[Baron 로그인] %s 코드: %s", label, code)
|
||||
if label == "로그인" {
|
||||
baseURL := os.Getenv("USERFRONT_URL")
|
||||
if baseURL == "" {
|
||||
@@ -2320,9 +2320,9 @@ func (h *AuthHandler) buildKratosShortSmsBody(req *kratosCourierRequest, loginID
|
||||
return ""
|
||||
}
|
||||
if h.isSmsCodeOnly(loginID) {
|
||||
return fmt.Sprintf("[Baron 통합로그인] 로그인 코드: %s", shortCode)
|
||||
return fmt.Sprintf("[Baron 로그인] 로그인 코드: %s", shortCode)
|
||||
}
|
||||
return fmt.Sprintf("[Baron 통합로그인] %s", link)
|
||||
return fmt.Sprintf("[Baron 로그인] %s", link)
|
||||
}
|
||||
|
||||
func (h *AuthHandler) buildKratosShortEmailBody(req *kratosCourierRequest, loginID string) (string, string) {
|
||||
@@ -2330,10 +2330,10 @@ func (h *AuthHandler) buildKratosShortEmailBody(req *kratosCourierRequest, login
|
||||
if !ok {
|
||||
return "", ""
|
||||
}
|
||||
subject := "[Baron 통합로그인] 로그인 링크"
|
||||
subject := "[Baron 로그인] 로그인 링크"
|
||||
body := fmt.Sprintf(`
|
||||
<div style="font-family: sans-serif; padding: 20px; border: 1px solid #eee; border-radius: 10px; max-width: 500px;">
|
||||
<h2 style="color: #1A1F2C;">Baron SSO 로그인</h2>
|
||||
<h2 style="color: #1A1F2C;">Baron 로그인</h2>
|
||||
<p>아래 버튼을 클릭하여 로그인을 완료해 주세요.</p>
|
||||
<div style="margin: 24px 0;">
|
||||
<a href="%s" style="background-color: #1A1F2C; color: white; padding: 12px 24px; text-decoration: none; border-radius: 5px; font-weight: bold;">로그인 완료하기</a>
|
||||
@@ -3074,7 +3074,7 @@ func (h *AuthHandler) GetAuthTimeline(c *fiber.Ctx) error {
|
||||
items := make([]authTimelineItem, 0, len(authLogs)+len(oathkeeperLogs))
|
||||
for i := range authLogs {
|
||||
log := authLogs[i]
|
||||
appName := "Baron 통합로그인"
|
||||
appName := "Baron 로그인"
|
||||
clientID := ""
|
||||
path := strings.ToLower(extractAuditPath(log))
|
||||
if strings.Contains(path, "/api/v1/auth/oidc/login/accept") {
|
||||
@@ -3221,9 +3221,8 @@ func (h *AuthHandler) ListLinkedRps(c *fiber.Ctx) error {
|
||||
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{"error": "Invalid session"})
|
||||
}
|
||||
|
||||
var sessions []domain.HydraConsentSession
|
||||
var sessions []domain.HydraConsentSession
|
||||
|
||||
|
||||
var lastErr error
|
||||
hasSuccess := false
|
||||
for _, subject := range subjects {
|
||||
@@ -3361,14 +3360,14 @@ func (h *AuthHandler) RevokeLinkedRp(c *fiber.Ctx) error {
|
||||
detailsBytes, _ := json.Marshal(detailsMap)
|
||||
|
||||
_ = h.AuditRepo.Create(&domain.AuditLog{
|
||||
EventID: GenerateSecureToken(16),
|
||||
Timestamp: time.Now(),
|
||||
UserID: subject,
|
||||
EventType: "consent.revoked",
|
||||
Status: "success",
|
||||
IPAddress: c.IP(),
|
||||
UserAgent: string(c.Request().Header.UserAgent()),
|
||||
Details: string(detailsBytes),
|
||||
EventID: GenerateSecureToken(16),
|
||||
Timestamp: time.Now(),
|
||||
UserID: subject,
|
||||
EventType: "consent.revoked",
|
||||
Status: "success",
|
||||
IPAddress: c.IP(),
|
||||
UserAgent: string(c.Request().Header.UserAgent()),
|
||||
Details: string(detailsBytes),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3534,14 +3533,14 @@ func (h *AuthHandler) AcceptConsentRequest(c *fiber.Ctx) error {
|
||||
detailsBytes, _ := json.Marshal(detailsMap)
|
||||
|
||||
_ = h.AuditRepo.Create(&domain.AuditLog{
|
||||
EventID: GenerateSecureToken(16),
|
||||
Timestamp: time.Now(),
|
||||
UserID: consentRequest.Subject,
|
||||
EventType: "consent.granted",
|
||||
Status: "success",
|
||||
IPAddress: c.IP(),
|
||||
UserAgent: string(c.Request().Header.UserAgent()),
|
||||
Details: string(detailsBytes),
|
||||
EventID: GenerateSecureToken(16),
|
||||
Timestamp: time.Now(),
|
||||
UserID: consentRequest.Subject,
|
||||
EventType: "consent.granted",
|
||||
Status: "success",
|
||||
IPAddress: c.IP(),
|
||||
UserAgent: string(c.Request().Header.UserAgent()),
|
||||
Details: string(detailsBytes),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3572,7 +3571,6 @@ func (h *AuthHandler) RejectConsentRequest(c *fiber.Ctx) error {
|
||||
return c.JSON(rejectResp)
|
||||
}
|
||||
|
||||
|
||||
func (h *AuthHandler) AcceptOidcLoginRequest(c *fiber.Ctx) error {
|
||||
var req struct {
|
||||
LoginChallenge string `json:"login_challenge"`
|
||||
@@ -3646,8 +3644,8 @@ func (h *AuthHandler) AcceptOidcLoginRequest(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func (h *AuthHandler) resolveCurrentProfile(c *fiber.Ctx) (*domain.UserProfileResponse, error) {
|
||||
slog.Info("🚨 [FATAL_DEBUG] ENVIRONMENT CHECK",
|
||||
"APP_ENV", os.Getenv("APP_ENV"),
|
||||
slog.Info("🚨 [FATAL_DEBUG] ENVIRONMENT CHECK",
|
||||
"APP_ENV", os.Getenv("APP_ENV"),
|
||||
"GO_ENV", os.Getenv("GO_ENV"),
|
||||
"X-Test-Role", c.Get("X-Test-Role"),
|
||||
)
|
||||
@@ -3661,9 +3659,9 @@ func (h *AuthHandler) resolveCurrentProfile(c *fiber.Ctx) (*domain.UserProfileRe
|
||||
|
||||
// Always log in development to see what's happening
|
||||
if appEnv == "dev" || appEnv == "development" || appEnv == "" {
|
||||
slog.Info("🔍 [AUTH_DEBUG] Checking mock role",
|
||||
"env", appEnv,
|
||||
"mockRole", mockRole,
|
||||
slog.Info("🔍 [AUTH_DEBUG] Checking mock role",
|
||||
"env", appEnv,
|
||||
"mockRole", mockRole,
|
||||
"X-Test-Role", c.Get("X-Test-Role"),
|
||||
"X-Mock-Role", c.Get("X-Mock-Role"),
|
||||
)
|
||||
@@ -3686,9 +3684,9 @@ func (h *AuthHandler) resolveCurrentProfile(c *fiber.Ctx) (*domain.UserProfileRe
|
||||
|
||||
// Mock bypass failed - log headers for debugging if in dev
|
||||
if appEnv == "dev" || appEnv == "development" || appEnv == "" {
|
||||
slog.Warn("⚠️ [DEBUG] Mock auth bypass failed",
|
||||
"appEnv", appEnv,
|
||||
"X-Test-Role", c.Get("X-Test-Role"),
|
||||
slog.Warn("⚠️ [DEBUG] Mock auth bypass failed",
|
||||
"appEnv", appEnv,
|
||||
"X-Test-Role", c.Get("X-Test-Role"),
|
||||
"X-Mock-Role", c.Get("X-Mock-Role"),
|
||||
"path", c.Path())
|
||||
}
|
||||
@@ -4973,7 +4971,7 @@ func (h *AuthHandler) SendUpdateCode(c *fiber.Ctx) error {
|
||||
h.RedisService.Set(key, code, 5*time.Minute)
|
||||
|
||||
// Send SMS
|
||||
content := fmt.Sprintf("[Baron 통합로그인] 정보 수정 인증번호: [%s]", code)
|
||||
content := fmt.Sprintf("[Baron 로그인] 정보 수정 인증번호: [%s]", code)
|
||||
go h.SmsService.SendSms(phone, content)
|
||||
|
||||
return c.JSON(fiber.Map{"message": "인증번호가 전송되었습니다."})
|
||||
|
||||
Reference in New Issue
Block a user