Skip to content

Commit

Permalink
Merge 479b405 into 2e70fbf
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Wiedemann authored Mar 27, 2023
2 parents 2e70fbf + 479b405 commit 3532d61
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ public Response getOIDCConfig(@PathParam("issuer-did") String issuerDidParam) {
});
credentialMetadata.setFormats(Map.of(FormatVO.LDP_VC.toString(), ldpVC, FormatVO.JWT_VC.toString(), jwtVC));
configAsMap.put("credentials_supported", Map.of("VerifiableCredential", credentialMetadata));
return Response.ok().entity(configAsMap).build();
return Response.ok()
.entity(configAsMap)
.header("Access-Control-Allow-Origin", "*")
.build();
}

@GET
Expand Down Expand Up @@ -424,8 +427,7 @@ public Response requestCredential(@PathParam("issuer-did") String issuerDidParam
assertIssuerDid(issuerDidParam);
LOGGER.infof("Received credentials request %s.", credentialRequestVO);


List<String> types = new ArrayList<>(Optional.ofNullable(credentialRequestVO.getTypes())
List<String> types = new ArrayList<>(Objects.requireNonNull(Optional.ofNullable(credentialRequestVO.getTypes())
.orElseGet(() -> {
try {
return objectMapper.readValue(credentialRequestVO.getType(), new TypeReference<List<String>>() {
Expand All @@ -434,7 +436,7 @@ public Response requestCredential(@PathParam("issuer-did") String issuerDidParam
LOGGER.warnf("Was not able to read the type parameter: %s", credentialRequestVO.getType(), e);
return null;
}
}));
})));

// remove the static type
types.remove(TYPE_VERIFIABLE_CREDENTIAL);
Expand Down Expand Up @@ -467,7 +469,8 @@ public Response requestCredential(@PathParam("issuer-did") String issuerDidParam
responseVO.setCredential(credentialObject);
} catch (JsonProcessingException e) {
LOGGER.warnf("Was not able to format credential %s.", credentialString, e);
throw new ErrorResponseException(getErrorResponse(ErrorType.UNSUPPORTED_CREDENTIAL_TYPE)); }
throw new ErrorResponseException(getErrorResponse(ErrorType.UNSUPPORTED_CREDENTIAL_TYPE));
}
break;
}
case JWT_VC_JSON: {
Expand Down Expand Up @@ -585,7 +588,7 @@ private List<ClientModel> getClientsOfType(String vcType, FormatVO format) {
@NotNull
private UserModel getUserFromSession(Optional<String> optionalToken) {
LOGGER.debugf("Extract user form session. Realm in context is %s.", session.getContext().getRealm());
// set the token in the context if its specifically provide. If empty, the authorization header will
// set the token in the context if its specifically provided. If empty, the authorization header will
// automatically be evaluated
optionalToken.ifPresent(bearerTokenAuthenticator::setTokenString);

Expand Down

0 comments on commit 3532d61

Please sign in to comment.