private static OAuthRegisteredService getRegisteredOAuthServiceByPredicate(final ServicesManager servicesManager,
                                                                               final Predicate<OAuthRegisteredService> predicate) {
        val services = servicesManager.getAllServicesOfType(OAuthRegisteredService.class);
        return services
            .stream()
            .filter(predicate)
            .findFirst()
            .orElse(null);
    }
Gets registered oauth service by redirect uri.

@param servicesManager the services manager
@param redirectUri     the redirect uri
@return the registered OAuth service by redirect uri
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java