private Optional<NameValuePair> getRequestParameter(final Service service, final String name) {
        try {
            val value = getJwtRequestParameter(service, name)
                .or(Unchecked.supplier(() -> {
                    val builder = new URIBuilder(service.getId());
                    return builder.getQueryParams()
                        .stream()
                        .filter(p -> p.getName().equals(name))
                        .map(NameValuePair::getValue)
                        .findFirst();
                }));
            return value.map(v -> new BasicNameValuePair(name, v));
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
        }
        return Optional.empty();
    }
This is {@link OAuth20AuthenticationServiceSelectionStrategy}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/services/OAuth20AuthenticationServiceSelectionStrategy.java