protected static Optional<NameValuePair> getEntityIdAsParameter(final Service service) {
        return FunctionUtils.doAndHandle(() -> {
            val builder = new URIBuilder(service.getId());
            return builder.getQueryParams()
                .stream()
                .filter(p -> p.getName().equals(SamlProtocolConstants.PARAMETER_ENTITY_ID))
                .findFirst();
        });
    }
Gets entity id as parameter.

@param service the service
@return the entity id as parameter
support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/SamlIdPEntityIdAuthenticationServiceSelectionStrategy.java