Search in sources :

Example 11 with RegistrationObject

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

the class NullAndroidSafetyNetAttestationStatementValidatorTest method validate_test.

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

Example 12 with RegistrationObject

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

the class NullAndroidSafetyNetAttestationStatementValidatorTest method validate_non_AndroidSafetyNetAttestation_test.

@Test
void validate_non_AndroidSafetyNetAttestation_test() {
    RegistrationObject registrationObject = TestDataUtil.createRegistrationObjectWithTPMAttestation();
    assertThrows(IllegalArgumentException.class, () -> target.validate(registrationObject));
}
Also used : RegistrationObject(com.webauthn4j.validator.RegistrationObject) Test(org.junit.jupiter.api.Test)

Example 13 with RegistrationObject

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

the class AppleAnonymousAttestationStatementValidatorTest method validate_non_AppleAnonymousAttestation_test.

@Test
void validate_non_AppleAnonymousAttestation_test() {
    RegistrationObject registrationObject = TestDataUtil.createRegistrationObjectWithTPMAttestation();
    assertThrows(IllegalArgumentException.class, () -> target.validate(registrationObject));
}
Also used : RegistrationObject(com.webauthn4j.validator.RegistrationObject) CoreRegistrationObject(com.webauthn4j.validator.CoreRegistrationObject) Test(org.junit.jupiter.api.Test)

Example 14 with RegistrationObject

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

the class PackedAttestationStatementValidatorTest method validate.

private void validate(byte[] clientDataBytes, AttestationObject attestationObject) {
    byte[] attestationObjectBytes = new AttestationObjectConverter(objectConverter).convertToBytes(attestationObject);
    Origin origin = new Origin(originUrl);
    Challenge challenge = (Challenge) () -> Base64UrlUtil.decode(challengeString);
    CollectedClientData collectedClientData = new CollectedClientDataConverter(objectConverter).convert(clientDataBytes);
    Set<AuthenticatorTransport> transports = Collections.emptySet();
    AuthenticationExtensionsClientOutputs<RegistrationExtensionClientOutput> authenticationExtensionsClientOutputs = new AuthenticationExtensionsClientOutputs<>();
    RegistrationObject registrationObject = new RegistrationObject(attestationObject, attestationObjectBytes, collectedClientData, clientDataBytes, authenticationExtensionsClientOutputs, transports, new ServerProperty(origin, rpId, challenge, tokenBindingId));
    target.validate(registrationObject);
}
Also used : Origin(com.webauthn4j.data.client.Origin) AttestationObjectConverter(com.webauthn4j.converter.AttestationObjectConverter) ServerProperty(com.webauthn4j.server.ServerProperty) CollectedClientDataConverter(com.webauthn4j.converter.CollectedClientDataConverter) RegistrationExtensionClientOutput(com.webauthn4j.data.extension.client.RegistrationExtensionClientOutput) Challenge(com.webauthn4j.data.client.challenge.Challenge) CollectedClientData(com.webauthn4j.data.client.CollectedClientData) RegistrationObject(com.webauthn4j.validator.RegistrationObject) AuthenticationExtensionsClientOutputs(com.webauthn4j.data.extension.client.AuthenticationExtensionsClientOutputs) AuthenticatorTransport(com.webauthn4j.data.AuthenticatorTransport)

Example 15 with RegistrationObject

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

the class NullTPMAttestationStatementValidatorTest method validate_non_TPMAttestation_test.

@Test
void validate_non_TPMAttestation_test() {
    RegistrationObject registrationObject = TestDataUtil.createRegistrationObjectWithAndroidKeyAttestation();
    assertThrows(IllegalArgumentException.class, () -> target.validate(registrationObject));
}
Also used : RegistrationObject(com.webauthn4j.validator.RegistrationObject) Test(org.junit.jupiter.api.Test)

Aggregations

RegistrationObject (com.webauthn4j.validator.RegistrationObject)40 Test (org.junit.jupiter.api.Test)31 RegistrationExtensionClientOutput (com.webauthn4j.data.extension.client.RegistrationExtensionClientOutput)9 CoreRegistrationObject (com.webauthn4j.validator.CoreRegistrationObject)9 DCRegistrationObject (com.webauthn4j.appattest.validator.DCRegistrationObject)8 AttestationObject (com.webauthn4j.data.attestation.AttestationObject)8 CollectedClientData (com.webauthn4j.data.client.CollectedClientData)8 AuthenticationExtensionsClientOutputs (com.webauthn4j.data.extension.client.AuthenticationExtensionsClientOutputs)7 AAGUID (com.webauthn4j.data.attestation.authenticator.AAGUID)2 Origin (com.webauthn4j.data.client.Origin)2 Challenge (com.webauthn4j.data.client.challenge.Challenge)2 DefaultChallenge (com.webauthn4j.data.client.challenge.DefaultChallenge)2 ServerProperty (com.webauthn4j.server.ServerProperty)2 DCServerProperty (com.webauthn4j.appattest.server.DCServerProperty)1 AttestationObjectConverter (com.webauthn4j.converter.AttestationObjectConverter)1 CollectedClientDataConverter (com.webauthn4j.converter.CollectedClientDataConverter)1 ObjectConverter (com.webauthn4j.converter.util.ObjectConverter)1 AuthenticatorAttestationType (com.webauthn4j.data.AuthenticatorAttestationType)1 AuthenticatorTransport (com.webauthn4j.data.AuthenticatorTransport)1 AndroidKeyAttestationStatement (com.webauthn4j.data.attestation.statement.AndroidKeyAttestationStatement)1