Repository navigation
Fix oid4vc mappers #29806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix oid4vc mappers #29806
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,6 @@ | |
| import static org.junit.Assert.assertEquals; | ||
| import static org.junit.Assert.assertFalse; | ||
| import static org.junit.Assert.assertNotNull; | ||
| import static org.junit.Assert.assertThrows; | ||
| import static org.junit.Assert.assertTrue; | ||
| import static org.junit.Assert.fail; | ||
|
|
||
|
|
@@ -335,6 +334,7 @@ public void testRequestCredentialUnsupportedCredential() throws Throwable { | |
| @Test | ||
| public void testRequestCredential() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about add these additional check in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, thank you:) Fixed in bf62374
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I confirmed the fix. Thank you. |
||
| String token = getBearerToken(oauth); | ||
| ObjectMapper objectMapper = new ObjectMapper(); | ||
| testingClient | ||
| .server(TEST_REALM_NAME) | ||
| .run((session -> { | ||
|
|
@@ -349,8 +349,12 @@ public void testRequestCredential() { | |
| assertNotNull("A credential should be responded.", credentialResponse.getEntity()); | ||
| CredentialResponse credentialResponseVO = OBJECT_MAPPER.convertValue(credentialResponse.getEntity(), CredentialResponse.class); | ||
| JsonWebToken jsonWebToken = TokenVerifier.create((String) credentialResponseVO.getCredential(), JsonWebToken.class).getToken(); | ||
| // correct signing and contents are verified in the JwtSigningServiceTest, thus we only check that it is a JWT | ||
|
|
||
| assertNotNull("A valid credential string should have been responded", jsonWebToken); | ||
| assertNotNull("The credentials should be included at the vc-claim.", jsonWebToken.getOtherClaims().get("vc")); | ||
| VerifiableCredential credential = objectMapper.convertValue(jsonWebToken.getOtherClaims().get("vc"), VerifiableCredential.class); | ||
| assertTrue("The static claim should be set.", credential.getCredentialSubject().getClaims().containsKey("VerifiableCredential")); | ||
| assertFalse("Only mappers supported for the requested type should have been evaluated.", credential.getCredentialSubject().getClaims().containsKey("AnotherCredentialType")); | ||
| })); | ||
| } | ||
|
|
||
|
|
@@ -482,6 +486,8 @@ private void requestOffer(String token, String credentialEndpoint, SupportedCred | |
| assertEquals(List.of("VerifiableCredential"), credential.getType()); | ||
| assertEquals(URI.create("did:web:test.org"), credential.getIssuer()); | ||
| assertEquals("john@email.cz", credential.getCredentialSubject().getClaims().get("email")); | ||
| assertTrue("The static claim should be set.", credential.getCredentialSubject().getClaims().containsKey("VerifiableCredential")); | ||
| assertFalse("Only mappers supported for the requested type should have been evaluated.", credential.getCredentialSubject().getClaims().containsKey("AnotherCredentialType")); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L79 import is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in bf62374
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed the fix. Thank you.