Skip to content
Snippets Groups Projects
Commit 02030d1e authored by Martin Vogel's avatar Martin Vogel
Browse files

chore: add call back validation javadoc and readme code example

parent c12979fb
No related branches found
No related tags found
1 merge request!103chore: add call back validation javadoc and readme code example
......@@ -229,6 +229,21 @@ Current status for submission 43cf7163-5163-4bc8-865e-be96e271ecc3 => incomplete
<img src="https://docs.fitko.de/fit-connect/assets/images/status-ebe91122f32321e22f094882a66c1139.svg">
### Validating callbacks
Usage
```java
final SenderClient senderClient = ClientFactory.senderClient(config);
final ValidationResult validationResult = senderClient.validateCallback("hmac", 0L, "body", "secret");
if(validationResult.hasError()){
LOGGER.error(validationresult.getError().getMessage());
}
```
## API Usage for Subscriber
### Retrieving submissions
......
......@@ -70,8 +70,17 @@ public class SenderClient {
return sender.getLastedEvent(destinationId, caseId, submissionId, authenticationTags);
}
public ValidationResult validateCallback(String hmac, Long timestamp, String httpBody, String callbackSecret) {
return this.sender.validateCallback(hmac, timestamp, httpBody, callbackSecret);
/**
* Checks if a received callback can be trusted by validating the provided request data.
*
* @param hmac authentication code provided by the callback
* @param timestamp timestamp provided by the callback
* @param httpBody HTTP body provided by the callback
* @param callbackSecret secret owned by the client, which is used to calculate the hmac
* @return {@code true} if hmac and timestamp provided by the callback meet the required conditions
*/
public ValidationResult validateCallback(final String hmac, final Long timestamp, final String httpBody, final String callbackSecret) {
return sender.validateCallback(hmac, timestamp, httpBody, callbackSecret);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment