Add bearer authentification (#3725)

Co-authored-by: mnival <extern.nival_michael@allianz.com>
This commit is contained in:
mnival
2025-02-28 01:30:45 +01:00
committed by GitHub
parent 44b2320644
commit 9d69b9e980

View File

@@ -25,8 +25,8 @@ class ApiAuthenticationFilter extends Filter with AccessTokenService with Accoun
val response = res.asInstanceOf[HttpServletResponse] val response = res.asInstanceOf[HttpServletResponse]
Option(request.getHeader("Authorization")) Option(request.getHeader("Authorization"))
.map { .map {
case auth if auth.toLowerCase().startsWith("token ") => case auth if auth.toLowerCase().startsWith("token ") || auth.toLowerCase().startsWith("bearer ") =>
AccessTokenService.getAccountByAccessToken(auth.substring(6).trim).toRight(()) AccessTokenService.getAccountByAccessToken(auth.substring(auth.indexOf(" ") + 1).trim).toRight(())
case auth if auth.startsWith("Basic ") => doBasicAuth(auth, loadSystemSettings(), request).toRight(()) case auth if auth.startsWith("Basic ") => doBasicAuth(auth, loadSystemSettings(), request).toRight(())
case _ => Left(()) case _ => Left(())
} }