use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class MetadataBLOBBasedTrustAnchorRepositoryTest method validate_test.
@Test
void validate_test() {
MetadataBLOBBasedTrustAnchorRepository target = createWithBlob("src/test/resources/integration/component/blob.jwt");
RegistrationObject registrationObject = TestDataUtil.createRegistrationObjectWithTPMAttestation();
@SuppressWarnings("ConstantConditions") AAGUID aaguid = registrationObject.getAttestationObject().getAuthenticatorData().getAttestedCredentialData().getAaguid();
assertThat(target.find(aaguid)).isNotEmpty();
}
use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class AndroidKeyAttestationStatementTest method equals_hashCode_test.
@Test
void equals_hashCode_test() {
RegistrationObject registrationObjectA = TestDataUtil.createRegistrationObjectWithAndroidKeyAttestation();
AndroidKeyAttestationStatement instanceA = (AndroidKeyAttestationStatement) registrationObjectA.getAttestationObject().getAttestationStatement();
RegistrationObject registrationObjectB = TestDataUtil.createRegistrationObjectWithAndroidKeyAttestation();
AndroidKeyAttestationStatement instanceB = (AndroidKeyAttestationStatement) registrationObjectB.getAttestationObject().getAttestationStatement();
assertAll(() -> assertThat(instanceA).isEqualTo(instanceB), () -> assertThat(instanceA).hasSameHashCodeAs(instanceB));
}
use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class AppleAnonymousAttestationStatementTest method equals_hashCode_test.
@Test
void equals_hashCode_test() {
RegistrationObject registrationObjectA = TestDataUtil.createRegistrationObjectWithAppleAttestation();
AppleAnonymousAttestationStatement instanceA = (AppleAnonymousAttestationStatement) registrationObjectA.getAttestationObject().getAttestationStatement();
RegistrationObject registrationObjectB = TestDataUtil.createRegistrationObjectWithAppleAttestation();
AppleAnonymousAttestationStatement instanceB = (AppleAnonymousAttestationStatement) registrationObjectB.getAttestationObject().getAttestationStatement();
assertThat(instanceA).isEqualTo(instanceB).hasSameHashCodeAs(instanceB);
}
use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class AppleAnonymousAttestationStatementTest method getter_test.
@Test
void getter_test() {
RegistrationObject registrationObject = TestDataUtil.createRegistrationObjectWithAppleAttestation();
AppleAnonymousAttestationStatement instance = (AppleAnonymousAttestationStatement) registrationObject.getAttestationObject().getAttestationStatement();
assertThat(instance.getFormat()).isEqualTo(AppleAnonymousAttestationStatement.FORMAT);
assertThat(instance.getX5c()).hasSize(2);
}
use of com.webauthn4j.validator.RegistrationObject in project webauthn4j by webauthn4j.
the class AndroidSafetyNetAttestationStatementValidatorTest method validate_test.
@Test
void validate_test() {
String rpId = "example.com";
Challenge challenge = new DefaultChallenge();
AuthenticatorSelectionCriteria authenticatorSelectionCriteria = new AuthenticatorSelectionCriteria(AuthenticatorAttachment.CROSS_PLATFORM, true, UserVerificationRequirement.REQUIRED);
PublicKeyCredentialParameters publicKeyCredentialParameters = new PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, COSEAlgorithmIdentifier.ES256);
PublicKeyCredentialUserEntity publicKeyCredentialUserEntity = new PublicKeyCredentialUserEntity(new byte[32], "username", "displayName");
AuthenticationExtensionsClientInputs<RegistrationExtensionClientInput> extensions = new AuthenticationExtensionsClientInputs<>();
PublicKeyCredentialCreationOptions credentialCreationOptions = new PublicKeyCredentialCreationOptions(new PublicKeyCredentialRpEntity(rpId, "example.com"), publicKeyCredentialUserEntity, challenge, Collections.singletonList(publicKeyCredentialParameters), null, Collections.emptyList(), authenticatorSelectionCriteria, AttestationConveyancePreference.DIRECT, extensions);
PublicKeyCredential<AuthenticatorAttestationResponse, RegistrationExtensionClientOutput> publicKeyCredential = clientPlatform.create(credentialCreationOptions);
RegistrationObject registrationObject = TestDataUtil.createRegistrationObject(publicKeyCredential);
target.validate(registrationObject);
}
Aggregations