Skip to content

Commit

Permalink
Debug: Log cb validation stuff
Browse files Browse the repository at this point in the history
This is meant to be temporary. Rotate cb secret afterwards.
  • Loading branch information
zechmeister committed Oct 31, 2024
1 parent 6f9100a commit 0a8af70
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,20 @@ protected void doFilterInternal(
String requestBody =
new String(wrappedRequest.getContentAsByteArray(), request.getCharacterEncoding());

String hmac = request.getHeader("callback-authentication");

ValidationResult result =
senderClient.validateCallback(
request.getHeader("callback-authentication"),
hmac,
Long.parseLong(request.getHeader("callback-timestamp")),
requestBody,
callbackSecret);

if (!result.isValid()) {
logger.info("Received invalid fit-connect callback");
logger.info(result.getProblems().toString());
logger.info(result.getError().getMessage());
logger.info("hmac: " + hmac);
logger.info("body: " + requestBody);
logger.info("Validation Error: " + result.getError().getMessage());
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
return;
}
Expand Down

0 comments on commit 0a8af70

Please sign in to comment.