Skip to content

Commit

Permalink
add extra log (#88)
Browse files Browse the repository at this point in the history
Co-authored-by: mdayican <mustafa.dayican@hmcts.net>
  • Loading branch information
mdayican and mdayican authored Oct 17, 2022
1 parent 898916d commit 3a0999a
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,20 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
String bearerToken = extractBearerToken(request);
String serviceName = authTokenValidator.getServiceName(bearerToken);
if (!authorisedServices.contains(serviceName)) {
LOG.debug("service forbidden {}", serviceName);
LOG.debug(
"service forbidden {} for endpoint: {} method: {} ",
serviceName,
request.getRequestURI(),
request.getMethod()
);
response.setStatus(HttpStatus.FORBIDDEN.value());
} else {
LOG.debug("service authorized {}", serviceName);
LOG.debug(
"service authorized {} for endpoint: {} method: {} ",
serviceName,
request.getRequestURI(),
request.getMethod()
);
filterChain.doFilter(request, response);
}
} catch (InvalidTokenException | ServiceException exception) {
Expand Down

0 comments on commit 3a0999a

Please sign in to comment.