use of com.webauthn4j.data.extension.client.AuthenticationExtensionsClientOutputs in project webauthn4j by webauthn4j.
the class TestDataUtil method createRegistrationObjectWithAppleAttestation.
public static RegistrationObject createRegistrationObjectWithAppleAttestation() {
byte[] collectedClientDataBytes = Base64UrlUtil.decode("eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoia093TXZFMm1RTzZvdTBCMGpqRDBWQSIsIm9yaWdpbiI6Imh0dHBzOi8vNmNjM2M5ZTc5NjdhLm5ncm9rLmlvIn0");
CollectedClientData collectedClientData = collectedClientDataConverter.convert(collectedClientDataBytes);
byte[] attestationObjectBytes = Base64UrlUtil.decode("o2NmbXRlYXBwbGVnYXR0U3RtdKJjYWxnJmN4NWOCWQJIMIICRDCCAcmgAwIBAgIGAXUCfWGDMAoGCCqGSM49BAMCMEgxHDAaBgNVBAMME0FwcGxlIFdlYkF1dGhuIENBIDExEzARBgNVBAoMCkFwcGxlIEluYy4xEzARBgNVBAgMCkNhbGlmb3JuaWEwHhcNMjAxMDA3MDk0NjEyWhcNMjAxMDA4MDk1NjEyWjCBkTFJMEcGA1UEAwxANjEyNzZmYzAyZDNmZThkMTZiMzNiNTU0OWQ4MTkyMzZjODE3NDZhODNmMmU5NGE2ZTRiZWUxYzcwZjgxYjViYzEaMBgGA1UECwwRQUFBIENlcnRpZmljYXRpb24xEzARBgNVBAoMCkFwcGxlIEluYy4xEzARBgNVBAgMCkNhbGlmb3JuaWEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAR5_lkIu1EpyAk4t1TATSs0DvpmFbmHaYv1naTlPqPm_vsD2qEnDVgE6KthwVqsokNcfb82nXHKFcUjsABKG3W3o1UwUzAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB_wQEAwIE8DAzBgkqhkiG92NkCAIEJjAkoSIEIJxgAhVAs-GYNN_jfsYkRcieGylPeSzka5QTwyMO84aBMAoGCCqGSM49BAMCA2kAMGYCMQDaHBjrI75xAF7SXzyF5zS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irYcFarKJDXH2_Np1xyhXFI7AASht1tw");
AttestationObject attestationObject = attestationObjectConverter.convert(attestationObjectBytes);
Set<AuthenticatorTransport> transports = Collections.emptySet();
AuthenticationExtensionsClientOutputs<RegistrationExtensionClientOutput> authenticationExtensionsClientOutputs = new AuthenticationExtensionsClientOutputs<>();
ServerProperty serverProperty = new ServerProperty(new Origin("https://6cc3c9e7967a.ngrok.io"), "6cc3c9e7967a.ngrok.io", new DefaultChallenge("kOwMvE2mQO6ou0B0jjD0VA"), null);
return new RegistrationObject(attestationObject, attestationObjectBytes, collectedClientData, collectedClientDataBytes, authenticationExtensionsClientOutputs, transports, serverProperty, Instant.parse("2020-10-07T10:00:00Z"));
}
use of com.webauthn4j.data.extension.client.AuthenticationExtensionsClientOutputs in project webauthn4j by webauthn4j.
the class TestDataUtil method createRegistrationObject.
public static RegistrationObject createRegistrationObject(Function<byte[], AttestationObject> attestationObjectProvider) {
CollectedClientData collectedClientData = createClientData(ClientDataType.WEBAUTHN_CREATE);
byte[] collectedClientDataBytes = collectedClientDataConverter.convertToBytes(collectedClientData);
AttestationObject attestationObject = attestationObjectProvider.apply(collectedClientDataBytes);
byte[] attestationObjectBytes = attestationObjectConverter.convertToBytes(attestationObject);
Set<AuthenticatorTransport> transports = Collections.emptySet();
AuthenticationExtensionsClientOutputs<RegistrationExtensionClientOutput> authenticationExtensionsClientOutputs = new AuthenticationExtensionsClientOutputs<>();
return new RegistrationObject(attestationObject, attestationObjectBytes, collectedClientData, collectedClientDataBytes, authenticationExtensionsClientOutputs, transports, TestDataUtil.createServerProperty());
}
use of com.webauthn4j.data.extension.client.AuthenticationExtensionsClientOutputs in project webauthn4j by webauthn4j.
the class RegistrationObjectTest method equals_hashCode_test.
@Test
void equals_hashCode_test() {
CollectedClientData clientData = TestDataUtil.createClientData(ClientDataType.WEBAUTHN_CREATE);
byte[] clientDataBytes = new CollectedClientDataConverter(objectConverter).convertToBytes(clientData);
AttestationObject attestationObject = TestDataUtil.createAttestationObjectWithFIDOU2FAttestationStatement();
byte[] attestationObjectBytes = new AttestationObjectConverter(objectConverter).convertToBytes(attestationObject);
Set<AuthenticatorTransport> transports = Collections.emptySet();
AuthenticationExtensionsClientOutputs<RegistrationExtensionClientOutput> clientExtensions = new AuthenticationExtensionsClientOutputs<>();
ServerProperty serverProperty = TestDataUtil.createServerProperty();
Instant timestamp = Instant.now();
RegistrationObject instanceA = new RegistrationObject(attestationObject, attestationObjectBytes, clientData, clientDataBytes, clientExtensions, transports, serverProperty, timestamp);
RegistrationObject instanceB = new RegistrationObject(attestationObject, attestationObjectBytes, clientData, clientDataBytes, clientExtensions, transports, serverProperty, timestamp);
assertAll(() -> assertThat(instanceA).isEqualTo(instanceB), () -> assertThat(instanceA).hasSameHashCodeAs(instanceB));
}
use of com.webauthn4j.data.extension.client.AuthenticationExtensionsClientOutputs in project webauthn4j by webauthn4j.
the class RegistrationObjectTest method getter_test.
@Test
void getter_test() {
CollectedClientData clientData = TestDataUtil.createClientData(ClientDataType.WEBAUTHN_CREATE);
byte[] clientDataBytes = new CollectedClientDataConverter(objectConverter).convertToBytes(clientData);
AttestationObject attestationObject = TestDataUtil.createAttestationObjectWithFIDOU2FAttestationStatement();
byte[] attestationObjectBytes = new AttestationObjectConverter(objectConverter).convertToBytes(attestationObject);
AuthenticatorData<RegistrationExtensionAuthenticatorOutput> authenticatorData = TestDataUtil.createAuthenticatorData();
byte[] authenticatorDataBytes = new AuthenticatorDataConverter(objectConverter).convert(authenticatorData);
Set<AuthenticatorTransport> transports = Collections.emptySet();
AuthenticationExtensionsClientOutputs<RegistrationExtensionClientOutput> clientExtensions = new AuthenticationExtensionsClientOutputs<>();
ServerProperty serverProperty = TestDataUtil.createServerProperty();
Instant timestamp = Instant.now();
RegistrationObject registrationObject = new RegistrationObject(attestationObject, attestationObjectBytes, clientData, clientDataBytes, clientExtensions, transports, serverProperty, timestamp);
assertAll(() -> assertThat(registrationObject.getCollectedClientData()).isEqualTo(clientData), () -> assertThat(registrationObject.getCollectedClientDataBytes()).isEqualTo(clientDataBytes), () -> assertThat(registrationObject.getAttestationObject()).isEqualTo(attestationObject), () -> assertThat(registrationObject.getAttestationObjectBytes()).isEqualTo(attestationObjectBytes), () -> assertThat(registrationObject.getAuthenticatorDataBytes()).isEqualTo(authenticatorDataBytes), () -> assertThat(registrationObject.getTransports()).isEqualTo(transports), () -> assertThat(registrationObject.getClientExtensions()).isEqualTo(clientExtensions), () -> assertThat(registrationObject.getServerProperty()).isEqualTo(serverProperty), () -> assertThat(registrationObject.getTimestamp()).isEqualTo(timestamp));
}
use of com.webauthn4j.data.extension.client.AuthenticationExtensionsClientOutputs in project webauthn4j by webauthn4j.
the class AuthenticationObjectTest method equals_hashCode_test.
@Test
void equals_hashCode_test() {
byte[] credentialId = new byte[32];
CollectedClientData clientData = TestDataUtil.createClientData(ClientDataType.WEBAUTHN_CREATE);
byte[] clientDataBytes = new CollectedClientDataConverter(objectConverter).convertToBytes(clientData);
AuthenticatorData<AuthenticationExtensionAuthenticatorOutput> authenticatorData = TestDataUtil.createAuthenticatorData();
byte[] authenticatorDataBytes = new AuthenticatorDataConverter(objectConverter).convert(authenticatorData);
AuthenticationExtensionsClientOutputs<AuthenticationExtensionClientOutput> clientExtensions = new AuthenticationExtensionsClientOutputs<>();
ServerProperty serverProperty = TestDataUtil.createServerProperty();
Authenticator authenticator = TestDataUtil.createAuthenticator();
AuthenticationObject instanceA = new AuthenticationObject(credentialId, authenticatorData, authenticatorDataBytes, clientData, clientDataBytes, clientExtensions, serverProperty, authenticator);
AuthenticationObject instanceB = new AuthenticationObject(credentialId, authenticatorData, authenticatorDataBytes, clientData, clientDataBytes, clientExtensions, serverProperty, authenticator);
assertAll(() -> assertThat(instanceA).isEqualTo(instanceB), () -> assertThat(instanceA).hasSameHashCodeAs(instanceB));
}
Aggregations