Expose downstream exception header for auth debug
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:
@@ -62,7 +62,15 @@ class FirebaseAuthFilter(
|
|||||||
val auth = UsernamePasswordAuthenticationToken(principal, token, emptyList())
|
val auth = UsernamePasswordAuthenticationToken(principal, token, emptyList())
|
||||||
SecurityContextHolder.getContext().authentication = auth
|
SecurityContextHolder.getContext().authentication = auth
|
||||||
setDebug("ok:userId=${principal.userId},superAdmin=${user.superAdmin}")
|
setDebug("ok:userId=${principal.userId},superAdmin=${user.superAdmin}")
|
||||||
filterChain.doFilter(request, response)
|
try {
|
||||||
|
filterChain.doFilter(request, response)
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
if (debug) {
|
||||||
|
val msg = ex.message?.take(200) ?: ""
|
||||||
|
response.setHeader("X-Downstream-Exception", "${ex::class.java.simpleName}:$msg")
|
||||||
|
}
|
||||||
|
throw ex
|
||||||
|
}
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
logger.debug("Auth failed for {}: {}", request.requestURI, ex.message)
|
logger.debug("Auth failed for {}: {}", request.requestURI, ex.message)
|
||||||
setDebug("verify_failed")
|
setDebug("verify_failed")
|
||||||
|
|||||||
Reference in New Issue
Block a user