public static RegisteredService resolveRegisteredService(final RequestContext requestContext,
                                                             final ServicesManager servicesManager,
                                                             final AuthenticationServiceSelectionPlan serviceSelectionStrategy) throws Throwable {
        val registeredService = getRegisteredService(requestContext);
        if (registeredService != null) {
            return registeredService;
        }
        val service = WebUtils.getService(requestContext);
        val serviceToUse = serviceSelectionStrategy.resolveService(service);
        if (serviceToUse != null) {
            return servicesManager.findServiceBy(serviceToUse);
        }
        return null;
    }
Resolve registered service.

@param requestContext           the request context
@param servicesManager          the services manager
@param serviceSelectionStrategy the service selection strategy
@return the service
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java