protected String determineIdentityProviderEntityId() {
        var idpEntityId = configuration.getIdentityProviderEntityId();
        if (idpEntityId == null) {
            var it = ((IterableMetadataSource) loaded).iterator();
            if (it.hasNext()) {
                var entityDescriptor = it.next();
                idpEntityId = entityDescriptor.getEntityID();
            }
        }

        if (idpEntityId == null) {
            throw new SAMLException("No idp entityId found");
        }
        return idpEntityId;
    }
If no idpEntityId declared, select first EntityDescriptor entityId as our IDP.

@return entity id of the idp
pac4j-saml/src/main/java/org/pac4j/saml/metadata/SAML2IdentityProviderMetadataResolver.java