class FidoMdsMetadataValidator implements CustomRegistrationValidator {

    @Override
    public void validate(RegistrationObject registrationObject) {
        AAGUID aaguid = registrationObject.getAttestationObject().getAuthenticatorData().getAttestedCredentialData().getAaguid();
        AttestationStatement attestationStatement = registrationObject.getAttestationObject().getAttestationStatement();

        Set<MetadataItem> metadataItems = metadataItemsResolver.resolve(aaguid);

        List<AttestationType> attestationTypes = metadataItems.stream()
                .flatMap(item -> item.getMetadataStatement().getAttestationTypes().stream()).collect(Collectors.toList());

        boolean isSurrogate = !attestationTypes.isEmpty() &&
                attestationTypes.stream().allMatch(type -> type.equals(AttestationType.BASIC_SURROGATE));

        if (isSurrogate && attestationStatement instanceof CertificateBaseAttestationStatement) {
            CertificateBaseAttestationStatement certificateBaseAttestationStatement = (CertificateBaseAttestationStatement) attestationStatement;
            if (certificateBaseAttestationStatement.getX5c() != null) {
                throw new BadAttestationStatementException("Although AAGUID is registered for surrogate attestation in metadata, x5c contains certificates.");
            }
        }

        for (MetadataItem metadataItem : metadataItems) {
            doAdditionalValidationForFidoMdsMetadataItem(metadataItem);
        }
    }

    public  FidoMdsMetadataValidator(MetadataItemsResolver metadataItemsResolver);
    public  FidoMdsMetadataValidator(ObjectConverter objectConverter, String fidoMetadataServiceEndpoint);
    public  FidoMdsMetadataValidator(String fidoMetadataServiceEndpoint);

}