Expose downstream exception header for auth debug
All checks were successful
build-and-deploy / build-deploy (push) Successful in 27s

This commit is contained in:
androidlover5842
2026-01-27 02:16:56 +05:30
parent be814eb0d5
commit 8c4afb8232

View File

@@ -62,7 +62,15 @@ class FirebaseAuthFilter(
val auth = UsernamePasswordAuthenticationToken(principal, token, emptyList())
SecurityContextHolder.getContext().authentication = auth
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) {
logger.debug("Auth failed for {}: {}", request.requestURI, ex.message)
setDebug("verify_failed")