Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpHeader - validate created message in Sender processor after creation #166

Open
IgorBalog-Eng opened this issue Feb 24, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@IgorBalog-Eng
Copy link
Collaborator

When receiving http-header request, and some of the mandatory headers is missing, so that created message will not be valid, this check should happen in SenderParseReceivedDataProcessorHttpHeader.

Now, message will be created, and in DapsService error will occur.
We should check sooner if message is valid. For that purpose, following code can be used, after we create message from http-headers.

javax.validation.* package

ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation> violations = validator.validate(message);
if(!violations.isEmpty()) {
logger.error("IDS Message validation failed");
message = null;
}

Check if we can create validator only once.

Update test for this processor to check if logic is valid.

@IgorBalog-Eng IgorBalog-Eng added the bug Something isn't working label Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant