From 4ca7b36d83437a0e4e65f9ca6e7c3380be445dc1 Mon Sep 17 00:00:00 2001 From: Alexander Schwarz Date: Thu, 30 Sep 2021 09:55:27 +0200 Subject: [PATCH] fix checkstyle --- .../decorator/controller/CallbackController.java | 3 ++- .../decorator/service/SubjectService.java | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/europa/ec/dgc/validation/decorator/controller/CallbackController.java b/src/main/java/eu/europa/ec/dgc/validation/decorator/controller/CallbackController.java index fd6b90a..3e3f684 100644 --- a/src/main/java/eu/europa/ec/dgc/validation/decorator/controller/CallbackController.java +++ b/src/main/java/eu/europa/ec/dgc/validation/decorator/controller/CallbackController.java @@ -53,7 +53,8 @@ public class CallbackController { * * @param subject Subject */ - @Operation(summary = "The optional callback endpoint receives the validation result to a subject", description = "The optional callback endpoint receives the validation result to a subject") + @Operation(summary = "The optional callback endpoint receives the validation result to a subject", + description = "The optional callback endpoint receives the validation result to a subject") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "401", description = "Unauthorized, if Result Token was not correctly signed"), diff --git a/src/main/java/eu/europa/ec/dgc/validation/decorator/service/SubjectService.java b/src/main/java/eu/europa/ec/dgc/validation/decorator/service/SubjectService.java index c079f69..9533da3 100644 --- a/src/main/java/eu/europa/ec/dgc/validation/decorator/service/SubjectService.java +++ b/src/main/java/eu/europa/ec/dgc/validation/decorator/service/SubjectService.java @@ -1,3 +1,4 @@ + package eu.europa.ec.dgc.validation.decorator.service; import eu.europa.ec.dgc.validation.decorator.config.DgcProperties.ServiceProperties; @@ -20,9 +21,15 @@ public class SubjectService { private final IdentityService identityService; - + private final BackendRepository backendRepository; - + + /** + * Determines the service based on the subject. + * + * @param subject Sibject ID + * @return {@link ServiceProperties} + */ public ServiceProperties getServiceBySubject(String subject) { final ServiceTokenContentResponse tokenContent = this.getBackendTokenContent(subject); if (tokenContent != null && tokenContent.getSubjects() == null || tokenContent.getSubjects().isEmpty()) { @@ -36,7 +43,7 @@ public ServiceProperties getServiceBySubject(String subject) { throw new DccException(String.format("Subject without service ID '%s'", serviceId), HttpStatus.NO_CONTENT.value()); } - + final String decodedServiceId = new String(Base64.getUrlDecoder().decode(serviceId), StandardCharsets.UTF_8); log.debug("Receive service ID (decoded) from booking service '{}'", decodedServiceId); @@ -44,7 +51,7 @@ public ServiceProperties getServiceBySubject(String subject) { log.debug("Receive service: {}", service); return service; } - + private ServiceTokenContentResponse getBackendTokenContent(final String subject) { try { return this.backendRepository.tokenContent(subject);