Search in sources :

Example 6 with PublicKeyCredentialDescriptor

use of com.webauthn4j.data.PublicKeyCredentialDescriptor in project webauthn4j-spring-security by webauthn4j.

the class AssertionOptionsTest method equals_hashCode_test.

@Test
public void equals_hashCode_test() {
    String rpId = "example.com";
    long timeout = 0;
    Challenge challenge = new DefaultChallenge();
    byte[] credentialId = new byte[32];
    List<PublicKeyCredentialDescriptor> allowCredentials = Collections.singletonList(new PublicKeyCredentialDescriptor(PublicKeyCredentialType.PUBLIC_KEY, credentialId, CollectionUtil.unmodifiableSet(AuthenticatorTransport.USB, AuthenticatorTransport.NFC, AuthenticatorTransport.BLE)));
    AssertionOptions instanceA = new AssertionOptions(challenge, timeout, rpId, allowCredentials, UserVerificationRequirement.DISCOURAGED, null);
    AssertionOptions instanceB = new AssertionOptions(challenge, timeout, rpId, allowCredentials, UserVerificationRequirement.DISCOURAGED, null);
    assertAll(() -> assertThat(instanceA).isEqualTo(instanceB), () -> assertThat(instanceA).hasSameHashCodeAs(instanceB));
}
Also used : DefaultChallenge(com.webauthn4j.data.client.challenge.DefaultChallenge) PublicKeyCredentialDescriptor(com.webauthn4j.data.PublicKeyCredentialDescriptor) Challenge(com.webauthn4j.data.client.challenge.Challenge) DefaultChallenge(com.webauthn4j.data.client.challenge.DefaultChallenge) Test(org.junit.Test)

Aggregations

PublicKeyCredentialDescriptor (com.webauthn4j.data.PublicKeyCredentialDescriptor)6 AuthenticatorData (com.webauthn4j.data.attestation.authenticator.AuthenticatorData)3 Test (org.junit.Test)3 Challenge (com.webauthn4j.data.client.challenge.Challenge)2 DefaultChallenge (com.webauthn4j.data.client.challenge.DefaultChallenge)2 AuthenticationExtensionAuthenticatorOutput (com.webauthn4j.data.extension.authenticator.AuthenticationExtensionAuthenticatorOutput)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 CBORFactory (com.fasterxml.jackson.dataformat.cbor.CBORFactory)1 ObjectConverter (com.webauthn4j.converter.util.ObjectConverter)1 PublicKeyCredentialParameters (com.webauthn4j.data.PublicKeyCredentialParameters)1 PublicKeyCredentialRpEntity (com.webauthn4j.data.PublicKeyCredentialRpEntity)1 AttestationObject (com.webauthn4j.data.attestation.AttestationObject)1 AttestedCredentialData (com.webauthn4j.data.attestation.authenticator.AttestedCredentialData)1 COSEKey (com.webauthn4j.data.attestation.authenticator.COSEKey)1 AttestationStatement (com.webauthn4j.data.attestation.statement.AttestationStatement)1 AuthenticationExtensionsAuthenticatorOutputs (com.webauthn4j.data.extension.authenticator.AuthenticationExtensionsAuthenticatorOutputs)1 RegistrationExtensionAuthenticatorOutput (com.webauthn4j.data.extension.authenticator.RegistrationExtensionAuthenticatorOutput)1 CredentialRequestResponse (com.webauthn4j.test.authenticator.CredentialRequestResponse)1 KeyPair (java.security.KeyPair)1 ECPrivateKey (java.security.interfaces.ECPrivateKey)1