private static Optional<NameValuePair> getRealmAsParameter(final Service service) {
        return FunctionUtils.doUnchecked(() -> {
            val builder = new URIBuilder(service.getId());
            return builder.getQueryParams()
                .stream()
                .filter(p -> p.getName().equals(WSFederationConstants.WTREALM))
                .findFirst();
        });
    }
This is {@link WSFederationAuthenticationServiceSelectionStrategy}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-ws-sts-api/src/main/java/org/apereo/cas/authentication/WSFederationAuthenticationServiceSelectionStrategy.java