use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class TPMAttestationStatementValidatorTest method validate_non_TPMAttestation_test.
@Test
void validate_non_TPMAttestation_test() {
RegistrationObject registrationObject = TestDataUtil.createRegistrationObjectWithAndroidKeyAttestation();
assertThrows(IllegalArgumentException.class, () -> target.validate(registrationObject));
}
use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class FIDOU2FAttestationStatementValidatorTest method validate_invalid_attestation_statement_test.
@Test
void validate_invalid_attestation_statement_test() {
RegistrationObject registrationObject = mock(RegistrationObject.class);
AttestationObject attestationObject = mock(AttestationObject.class);
when(registrationObject.getAttestationObject()).thenReturn(attestationObject);
when(attestationObject.getAttestationStatement()).thenReturn(new NoneAttestationStatement());
assertThrows(IllegalArgumentException.class, () -> target.validate(registrationObject));
}
use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class TPMAttestationStatementTest method constructor_test.
@Test
void constructor_test() {
RegistrationObject registrationObjectA = TestDataUtil.createRegistrationObjectWithTPMAttestation();
TPMAttestationStatement source = (TPMAttestationStatement) registrationObjectA.getAttestationObject().getAttestationStatement();
TPMAttestationStatement tpmAttestationStatement = new TPMAttestationStatement(source.getAlg(), source.getX5c(), source.getSig(), source.getCertInfo(), source.getPubArea());
assertAll(() -> assertThat(tpmAttestationStatement.getAlg()).isEqualTo(source.getAlg()), () -> assertThat(tpmAttestationStatement.getX5c()).isEqualTo(source.getX5c()), () -> assertThat(tpmAttestationStatement.getSig()).isEqualTo(source.getSig()), () -> assertThat(tpmAttestationStatement.getCertInfo()).isEqualTo(source.getCertInfo()), () -> assertThat(tpmAttestationStatement.getPubArea()).isEqualTo(source.getPubArea()));
}
use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class TPMAttestationStatementTest method validate_test.
@Test
void validate_test() {
RegistrationObject registrationObjectA = TestDataUtil.createRegistrationObjectWithTPMAttestation();
TPMAttestationStatement source = (TPMAttestationStatement) registrationObjectA.getAttestationObject().getAttestationStatement();
TPMAttestationStatement tpmAttestationStatement = new TPMAttestationStatement(source.getAlg(), new AttestationCertificatePath(), source.getSig(), source.getCertInfo(), source.getPubArea());
assertThrows(ConstraintViolationException.class, tpmAttestationStatement::validate);
}
use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class TPMAttestationStatementTest method equals_hashCode_test.
@Test
void equals_hashCode_test() {
RegistrationObject registrationObjectA = TestDataUtil.createRegistrationObjectWithTPMAttestation();
TPMAttestationStatement instanceA = (TPMAttestationStatement) registrationObjectA.getAttestationObject().getAttestationStatement();
RegistrationObject registrationObjectB = TestDataUtil.createRegistrationObjectWithTPMAttestation();
TPMAttestationStatement instanceB = (TPMAttestationStatement) registrationObjectB.getAttestationObject().getAttestationStatement();
assertAll(() -> assertThat(instanceA).isEqualTo(instanceB), () -> assertThat(instanceA).hasSameHashCodeAs(instanceB));
}
Aggregations