Skip to content

Commit

Permalink
Avoid JSON (de-)serialization again.
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Sabadello <[email protected]>
  • Loading branch information
peacekeeper committed Oct 15, 2020
1 parent 60b41c4 commit 3cca186
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.IOException;
import java.net.URI;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;

public class ToJwtConverter {
Expand Down Expand Up @@ -72,16 +73,8 @@ public static JwtVerifiableCredential toJwtVerifiableCredential(VerifiableCreden
jwtPayloadBuilder.audience(aud);
}

try {
Map<String, Object> vcClaimValue = new ObjectMapper().readValue(payloadVerifiableCredential.toJson(), Map.class);
jwtPayloadBuilder.claim(JwtKeywords.JWT_CLAIM_VC, vcClaimValue);
} catch (RuntimeException ex) {
throw new RuntimeException(ex);
} catch (JsonParseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Map<String, Object> vcClaimValue = new LinkedHashMap<>(payloadVerifiableCredential.getJsonObject());
jwtPayloadBuilder.claim(JwtKeywords.JWT_CLAIM_VC, vcClaimValue);

JWTClaimsSet jwtPayload = jwtPayloadBuilder.build();

Expand Down

0 comments on commit 3cca186

Please sign in to comment.