com.webauthn4j.validator.attestation.statement.u2f.FIDOU2FAttestationStatementValidator Java Examples

The following examples show how to use com.webauthn4j.validator.attestation.statement.u2f.FIDOU2FAttestationStatementValidator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebAuthnRegistrationManagerTest.java    From webauthn4j with Apache License 2.0 6 votes vote down vote up
@Test
void constructor_test() {
    NoneAttestationStatementValidator noneAttestationStatementValidator = new NoneAttestationStatementValidator();
    PackedAttestationStatementValidator packedAttestationStatementValidator = new PackedAttestationStatementValidator();
    FIDOU2FAttestationStatementValidator fidoU2FAttestationStatementValidator = new FIDOU2FAttestationStatementValidator();
    AndroidKeyAttestationStatementValidator androidKeyAttestationStatementValidator = new AndroidKeyAttestationStatementValidator();
    TrustAnchorsResolver trustAnchorsResolver = TestAttestationUtil.createTrustAnchorProviderWith3tierTestRootCACertificate();
    WebAuthnRegistrationManager webAuthnRegistrationManager = new WebAuthnRegistrationManager(
            Arrays.asList(
                    noneAttestationStatementValidator,
                    packedAttestationStatementValidator,
                    fidoU2FAttestationStatementValidator,
                    androidKeyAttestationStatementValidator),
            new TrustAnchorCertPathTrustworthinessValidator(trustAnchorsResolver),
            new DefaultSelfAttestationTrustworthinessValidator()
    );
    assertThat(webAuthnRegistrationManager).isNotNull();
}
 
Example #2
Source File: WebAuthnManagerTest.java    From webauthn4j with Apache License 2.0 6 votes vote down vote up
@Test
void constructor_test() {
    NoneAttestationStatementValidator noneAttestationStatementValidator = new NoneAttestationStatementValidator();
    PackedAttestationStatementValidator packedAttestationStatementValidator = new PackedAttestationStatementValidator();
    FIDOU2FAttestationStatementValidator fidoU2FAttestationStatementValidator = new FIDOU2FAttestationStatementValidator();
    AndroidKeyAttestationStatementValidator androidKeyAttestationStatementValidator = new AndroidKeyAttestationStatementValidator();
    TrustAnchorsResolver trustAnchorsResolver = TestAttestationUtil.createTrustAnchorProviderWith3tierTestRootCACertificate();
    WebAuthnManager webAuthnManager = new WebAuthnManager(
            Arrays.asList(
                    noneAttestationStatementValidator,
                    packedAttestationStatementValidator,
                    fidoU2FAttestationStatementValidator,
                    androidKeyAttestationStatementValidator),
            new TrustAnchorCertPathTrustworthinessValidator(trustAnchorsResolver),
            new DefaultSelfAttestationTrustworthinessValidator()
    );
    assertThat(webAuthnManager).isNotNull();
}
 
Example #3
Source File: AttestationValidatorTest.java    From webauthn4j with Apache License 2.0 5 votes vote down vote up
@Test
void validateAAGUID(@Mock(answer = Answers.RETURNS_DEEP_STUBS) AuthenticatorData<RegistrationExtensionAuthenticatorOutput<?>> authenticatorData) {
    AttestationValidator attestationValidator = new AttestationValidator(
            Collections.singletonList(new FIDOU2FAttestationStatementValidator()),
            new NullCertPathTrustworthinessValidator(),
            new NullSelfAttestationTrustworthinessValidator());

    AttestationObject attestationObject = mock(AttestationObject.class);
    when(attestationObject.getFormat()).thenReturn(FIDOU2FAttestationStatement.FORMAT);
    when(authenticatorData.getAttestedCredentialData().getAaguid()).thenReturn(new AAGUID("fea37a71-08ce-479f-bf4b-472a93e2d17d"));
    when(attestationObject.getAuthenticatorData()).thenReturn(authenticatorData);
    assertThrows(BadAaguidException.class,
            () -> attestationValidator.validateAAGUID(attestationObject)
    );
}
 
Example #4
Source File: WebAuthnRegister.java    From keycloak with Apache License 2.0 5 votes vote down vote up
private WebAuthnRegistrationManager createWebAuthnRegistrationManager() {
    return new WebAuthnRegistrationManager(
            Arrays.asList(
                    new NoneAttestationStatementValidator(),
                    new PackedAttestationStatementValidator(),
                    new TPMAttestationStatementValidator(),
                    new AndroidKeyAttestationStatementValidator(),
                    new AndroidSafetyNetAttestationStatementValidator(),
                    new FIDOU2FAttestationStatementValidator()
            ), this.certPathtrustValidator,
            new DefaultSelfAttestationTrustworthinessValidator(),
            Collections.emptyList(), // Custom Registration Validator is not supported
            new ObjectConverter()
            );
}