Log auth verify user-not-found
All checks were successful
build-and-deploy / build-deploy (push) Successful in 27s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 27s
This commit is contained in:
@@ -74,6 +74,7 @@ class Auth(
|
|||||||
"Missing Authorization token"
|
"Missing Authorization token"
|
||||||
)
|
)
|
||||||
if (!header.startsWith("Bearer ")) {
|
if (!header.startsWith("Bearer ")) {
|
||||||
|
logger.warn("Auth verify invalid Authorization header")
|
||||||
throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "Invalid Authorization header")
|
throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "Invalid Authorization header")
|
||||||
}
|
}
|
||||||
val token = header.removePrefix("Bearer ").trim()
|
val token = header.removePrefix("Bearer ").trim()
|
||||||
@@ -84,7 +85,10 @@ class Auth(
|
|||||||
throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "Invalid token")
|
throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "Invalid token")
|
||||||
}
|
}
|
||||||
val user = appUserRepo.findByFirebaseUid(decoded.uid)
|
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)
|
logger.warn("Auth verify resolved uid={}, userId={}", decoded.uid, user.id)
|
||||||
return MyPrincipal(
|
return MyPrincipal(
|
||||||
userId = user.id ?: throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "User id missing"),
|
userId = user.id ?: throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "User id missing"),
|
||||||
|
|||||||
Reference in New Issue
Block a user