Skip to content

[java]: Fix addCredential() in VirtualAuthenticator #15633

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

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[java]: Fix getCredentials from VirtualAuthenticator
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Apr 16, 2025
commit 5255a43ce401bb28e0bcb59a5865c0e0b6901e05
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static Credential fromMap(Map<String, Object> map) {
Object credentialId = Require.nonNull("credentialId", map.get("credentialId"));
Object isResidentCredential =
Require.nonNull("isResidentCredential", map.get("isResidentCredential"));
Object rpId = Require.nonNull("rpId", map.get("rpId"));
Object rpId = map.get("rpId");
Object privateKey = Require.nonNull("privateKey", map.get("privateKey"));
Object userHandle = map.get("userHandle");
Object signCount = Require.nonNull("signCount", map.get("signCount"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ void testAddNonResidentCredential() {
Credential.createNonResidentCredential(
credentialId, "localhost", privateKey, /* signCount= */ 0);
authenticator.addCredential(credential);
authenticator.getCredentials();

// Attempt to use the credential to generate an assertion.
Object response = getAssertionFor(Arrays.asList(1, 2, 3, 4));
Expand All @@ -215,6 +216,7 @@ void testAddNonResidentCredentialWhenAuthenticatorUsesU2FProtocol() {
Credential.createNonResidentCredential(
credentialId, "localhost", privateKey, /* signCount= */ 0);
authenticator.addCredential(credential);
authenticator.getCredentials();

// Attempt to use the credential to generate an assertion.
Object response = getAssertionFor(Arrays.asList(1, 2, 3, 4));
Expand All @@ -231,6 +233,7 @@ void testAddResidentCredential() {
Credential.createResidentCredential(
credentialId, "localhost", privateKey, userHandle, /* signCount= */ 0);
authenticator.addCredential(credential);
authenticator.getCredentials();

// Attempt to use the credential to generate an assertion. Notice we use an
// empty allowCredentials array.
Expand Down Expand Up @@ -265,6 +268,7 @@ void testAddResidentCredentialNotSupportedWhenAuthenticatorUsesU2FProtocol() {
Credential.createResidentCredential(
credentialId, "localhost", privateKey, userHandle, /* signCount= */ 0);
authenticator.addCredential(credential);
authenticator.getCredentials();
});
}

Expand Down
Loading