Search in sources :

Example 1 with CoreRegistrationObject

use of com.webauthn4j.validator.CoreRegistrationObject in project webauthn4j by webauthn4j.

the class TestDataUtil method createCoreRegistrationObjectWithAppleAppAttestAttestation.

public static CoreRegistrationObject createCoreRegistrationObjectWithAppleAppAttestAttestation() {
    // Key ID: "eTAkPnbDrHW+v17P3CrBvb4gPKLxpSxvsnyVTFXVq+w="
    byte[] collectedClientDataBytes = Base64UrlUtil.decode("eyJvcmlnaW4iOiJodHRwOi8vbG9jYWxob3N0OjgwODAiLCJjaGFsbGVuZ2UiOiJkM1Z5ZW1Wc2NHWnliM0JtIiwidHlwZSI6IndlYmF1dGhuLmNyZWF0ZSJ9");
    byte[] clientDataHash = MessageDigestUtil.createSHA256().digest(collectedClientDataBytes);
    byte[] attestationObjectBytes = Base64UrlUtil.decode("o2NmbXRvYXBwbGUtYXBwYXR0ZXN0Z2F0dFN0bXSiY3g1Y4JZAvYwggLyMIICeaADAgECAgYBc_5ZDswwCgYIKoZIzj0EAwIwTzEjMCEGA1UEAwwaQXBwbGUgQXBwIEF0dGVzdGF0aW9uIENBIDExEzARBgNVBAoMCkFwcGxlIEluYy4xEzARBgNVBAgMCkNhbGlmb3JuaWEwHhcNMjAwODE3MjEyNTE2WhcNMjAwODE4MjEzNTE2WjCBkTFJMEcGA1UEAwxANTQ0ZTk0ODEwNTA5MTNlOThjMzRiYzg5MmM5ZjI1Y2NmMGM4YmQ0NjA3YTdmNjdkZGUzMjE2MDA4ZDk5MTU3YjEaMBgGA1UECwwRQUFBIENlcnRpZmljYXRpb24xEzARBgNVBAoMCkFwcGxlIEluYy4xEzARBgNVBAgMCkNhbGlmb3JuaWEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAR3d82Uh2zHPFbH86C-5P3SNOg37xIM0bRuqoz0uSTkSFboZc99_wFlXW0MZKruzD0UAHWmg9KyBk4Q0vlhJ0CTo4H9MIH6MAwGA1UdEwEB_wQCMAAwDgYDVR0PAQH_BAQDAgTwMIGJBgkqhk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ayQkf772BAAAAAAAAaGF1dGhEYXRhWKQ55G_XcFes9vC8TnMMtLn-dO2k9aSdIb2vEJj7jXeszEAAAAAAYXBwYXR0ZXN0ZGV2ZWxvcAAgVE6UgQUJE-mMNLyJLJ8lzPDIvUYHp_Z93jIWAI2ZFXulAQIDJiABIVggd3fNlIdsxzxWx_OgvuT90jToN-8SDNG0bqqM9Lkk5EgiWCBW6GXPff8BZV1tDGSq7sw9FAB1poPSsgZOENL5YSdAkw");
    AttestationObject attestationObject = attestationObjectConverter.convert(attestationObjectBytes);
    Set<AuthenticatorTransport> transports = Collections.emptySet();
    AuthenticationExtensionsClientOutputs<RegistrationExtensionClientOutput> authenticationExtensionsClientOutputs = new AuthenticationExtensionsClientOutputs<>();
    Instant timestamp = Instant.parse("2020-08-18T13:37:00");
    return new CoreRegistrationObject(attestationObject, attestationObjectBytes, clientDataHash, TestDataUtil.createServerProperty(), timestamp);
}
Also used : Instant(java.time.Instant) AttestationObject(com.webauthn4j.data.attestation.AttestationObject) AuthenticationExtensionsClientOutputs(com.webauthn4j.data.extension.client.AuthenticationExtensionsClientOutputs) CoreRegistrationObject(com.webauthn4j.validator.CoreRegistrationObject) RegistrationExtensionClientOutput(com.webauthn4j.data.extension.client.RegistrationExtensionClientOutput)

Example 2 with CoreRegistrationObject

use of com.webauthn4j.validator.CoreRegistrationObject in project webauthn4j by webauthn4j.

the class AbstractStatementValidatorTest method supports_with_null_test.

@Test
void supports_with_null_test() {
    CoreRegistrationObject coreRegistrationObject = mock(CoreRegistrationObject.class, Mockito.RETURNS_DEEP_STUBS);
    when(coreRegistrationObject.getAttestationObject().getAttestationStatement()).thenReturn(null);
    assertThat(packedAttestationStatementValidator.supports(coreRegistrationObject)).isFalse();
}
Also used : CoreRegistrationObject(com.webauthn4j.validator.CoreRegistrationObject) Test(org.junit.jupiter.api.Test)

Example 3 with CoreRegistrationObject

use of com.webauthn4j.validator.CoreRegistrationObject in project webauthn4j by webauthn4j.

the class AppleAnonymousAttestationStatementValidatorTest method validate_test.

@Test
void validate_test() {
    CoreRegistrationObject coreRegistrationObject = TestDataUtil.createRegistrationObjectWithAppleAttestation();
    target.validate(coreRegistrationObject);
}
Also used : CoreRegistrationObject(com.webauthn4j.validator.CoreRegistrationObject) Test(org.junit.jupiter.api.Test)

Example 4 with CoreRegistrationObject

use of com.webauthn4j.validator.CoreRegistrationObject in project webauthn4j by webauthn4j.

the class NullAppleAnonymousAttestationStatementValidatorTest method validate_test.

@Test
void validate_test() {
    CoreRegistrationObject registrationObject = TestDataUtil.createRegistrationObjectWithAppleAttestation();
    target.validate(registrationObject);
}
Also used : CoreRegistrationObject(com.webauthn4j.validator.CoreRegistrationObject) Test(org.junit.jupiter.api.Test)

Aggregations

CoreRegistrationObject (com.webauthn4j.validator.CoreRegistrationObject)4 Test (org.junit.jupiter.api.Test)3 AttestationObject (com.webauthn4j.data.attestation.AttestationObject)1 AuthenticationExtensionsClientOutputs (com.webauthn4j.data.extension.client.AuthenticationExtensionsClientOutputs)1 RegistrationExtensionClientOutput (com.webauthn4j.data.extension.client.RegistrationExtensionClientOutput)1 Instant (java.time.Instant)1