Search in sources :

Example 6 with DCRegistrationObject

use of com.webauthn4j.appattest.validator.DCRegistrationObject in project webauthn4j by webauthn4j.

the class NullAppleAppAttestAttestationStatementValidatorTest method validate_test.

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

Example 7 with DCRegistrationObject

use of com.webauthn4j.appattest.validator.DCRegistrationObject in project webauthn4j by webauthn4j.

the class AppleAppAttestAttestationStatementValidator method validate.

@Override
public AttestationType validate(@NonNull CoreRegistrationObject registrationObject) {
    AssertUtil.notNull(registrationObject, "registrationObject must not be null");
    if (!(registrationObject instanceof DCRegistrationObject)) {
        throw new IllegalArgumentException("registrationObject must be an instance of DCRegistrationObject.");
    }
    if (!supports(registrationObject)) {
        throw new IllegalArgumentException(String.format("Specified format '%s' is not supported by %s.", registrationObject.getAttestationObject().getFormat(), this.getClass().getName()));
    }
    AppleAppAttestAttestationStatement attestationStatement = (AppleAppAttestAttestationStatement) registrationObject.getAttestationObject().getAttestationStatement();
    validateAttestationStatementNotNull(attestationStatement);
    validateX5c(attestationStatement);
    validateNonce(registrationObject);
    validatePublicKey(registrationObject);
    return AttestationType.BASIC;
}
Also used : DCRegistrationObject(com.webauthn4j.appattest.validator.DCRegistrationObject) AppleAppAttestAttestationStatement(com.webauthn4j.appattest.data.attestation.statement.AppleAppAttestAttestationStatement)

Aggregations

DCRegistrationObject (com.webauthn4j.appattest.validator.DCRegistrationObject)7 Test (org.junit.jupiter.api.Test)4 AppleAppAttestAttestationStatement (com.webauthn4j.appattest.data.attestation.statement.AppleAppAttestAttestationStatement)1 DCServerProperty (com.webauthn4j.appattest.server.DCServerProperty)1 AttestationObject (com.webauthn4j.data.attestation.AttestationObject)1 DefaultChallenge (com.webauthn4j.data.client.challenge.DefaultChallenge)1 BadAttestationStatementException (com.webauthn4j.validator.exception.BadAttestationStatementException)1 Instant (java.time.Instant)1