Log auth verify user-not-found
All checks were successful
build-and-deploy / build-deploy (push) Successful in 27s

This commit is contained in:
androidlover5842
2026-01-26 21:45:26 +05:30
parent 85254b229f
commit e3a7053d78

View File

@@ -74,6 +74,7 @@ class Auth(
"Missing Authorization token"
)
if (!header.startsWith("Bearer ")) {
logger.warn("Auth verify invalid Authorization header")
throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "Invalid Authorization header")
}
val token = header.removePrefix("Bearer ").trim()
@@ -84,7 +85,10 @@ class Auth(
throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "Invalid token")
}
val user = appUserRepo.findByFirebaseUid(decoded.uid)
?: throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "User not found")
?: run {
logger.warn("Auth verify user not found for uid={}", decoded.uid)
throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "User not found")
}
logger.warn("Auth verify resolved uid={}, userId={}", decoded.uid, user.id)
return MyPrincipal(
userId = user.id ?: throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "User id missing"),