Skip to content

Commit

Permalink
Merge pull request #14 from eu-digital-green-certificates/fix/missing…
Browse files Browse the repository at this point in the history
…fields

change status endpoint code to 204
  • Loading branch information
epicsoft-llc authored Sep 22, 2021
2 parents ee07b45 + 73b7f81 commit 8102269
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ build/
.settings.xml
/bin/
src/main/resources/application-local-cf.yml
src/main/resources/application-localcf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import eu.europa.ec.dgc.validation.decorator.entity.ValidationServiceIdentityResponse;
import eu.europa.ec.dgc.validation.decorator.entity.ValidationServiceIdentityResponse.PublicKeyJwk;
import eu.europa.ec.dgc.validation.decorator.entity.ValidationServiceStatusResponse;
import eu.europa.ec.dgc.validation.decorator.exception.DccException;
import eu.europa.ec.dgc.validation.decorator.exception.NotFoundException;
import eu.europa.ec.dgc.validation.decorator.exception.RepositoryException;
import eu.europa.ec.dgc.validation.decorator.exception.UncheckedCertificateException;
Expand Down Expand Up @@ -80,14 +81,15 @@ public class ValidationStatusService {
public ValidationServiceStatusResponse determineStatus(final String subject) {
final ServiceTokenContentResponse tokenContent = this.getBackendTokenContent(subject);
if (tokenContent.getSubjects() == null || tokenContent.getSubjects().isEmpty()) {
throw new NotFoundException("Subject not found in token");
throw new DccException("Subject not found in token", HttpStatus.NO_CONTENT.value());
}

final SubjectResponse subjectResponse = tokenContent.getSubjects().get(0);
final String serviceId = subjectResponse.getServiceIdUsed();
log.debug("Receive service ID (encoded) from booking service '{}'", serviceId);
if (serviceId == null || serviceId.isBlank()) {
throw new NotFoundException(String.format("Passenger without service ID '%s'", serviceId));
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);
Expand Down

0 comments on commit 8102269

Please sign in to comment.