private Optional<RegisteredService> getRegisteredServiceFromRequest(final HttpServletRequest request) {
        val service = this.argumentExtractor.extractService(request);
        if (service != null) {
            val resolved = authenticationRequestServiceSelectionStrategies.resolveService(service);
            return Optional.ofNullable(this.servicesManager.findServiceBy(resolved));
        }
        return Optional.empty();
    }
private Optional < RegisteredService > getRegisteredServiceFromRequest ( final HttpServletRequest request ) { val service = this . argumentExtractor . extractService ( request ) ; if ( service != null ) { val resolved = authenticationRequestServiceSelectionStrategies . resolveService ( service ) ; return Optional . ofNullable ( this . servicesManager . findServiceBy ( resolved ) ) ; } return Optional . empty ( ) ; }
Gets registered service from request.
Reading the request body by the argument extractor here may cause the underlying request stream
to close. If there are any underlying controllers or components that expect to read
or parse the request body, like those that handle ticket validation, they would fail given the
{@link HttpServletRequest#getReader()} is consumed by the argument extractor here and not available anymore.
Therefor, any of the inner components of the extractor might have to cache the request body
as an attribute, etc so they can re-process and re-extract as needed.

@param request the request
@return the registered service from request