Skip to content

Commit

Permalink
fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
epicsoft-llc committed Sep 30, 2021
1 parent a68cf22 commit 4ca7b36
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

package eu.europa.ec.dgc.validation.decorator.service;

import eu.europa.ec.dgc.validation.decorator.config.DgcProperties.ServiceProperties;
Expand All @@ -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()) {
Expand All @@ -36,15 +43,15 @@ 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);

final ServiceProperties service = this.identityService.getServicePropertiesById(decodedServiceId);
log.debug("Receive service: {}", service);
return service;
}

private ServiceTokenContentResponse getBackendTokenContent(final String subject) {
try {
return this.backendRepository.tokenContent(subject);
Expand Down

0 comments on commit 4ca7b36

Please sign in to comment.