Source:
protected WebApplicationService extractServiceInternal(final HttpServletRequest request) { logger.debug("Attempting to extract multifactor authentication parameters from the request"); WebApplicationService targetService = null; for (final ArgumentExtractor extractor : this.supportedArgumentExtractors) { targetService = extractor.extractService(request); if (targetService != null) { logger.debug("[{}] intercepted the request successfully for multifactor authentication", extractor.getClass().getSimpleName()); break; } } if (targetService == null) { logger.debug("Request is unable to identify the target application"); return null; } final String authenticationMethod = request.getParameter(MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD); if (!StringUtils.hasText(authenticationMethod)) { logger.debug("Request has no request parameter [{}]", MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD); return null; } if (!supportedAuthenticationMethods.contains(authenticationMethod)) { logger.debug("CAS is not configured to support parameter value [{}].", MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD, authenticationMethod); if (request.getAttribute(UnrecognizedAuthenticationMethodException.class.getName()) == null) { request.setAttribute(UnrecognizedAuthenticationMethodException.class.getName(), Boolean.TRUE.toString()); throw new UnrecognizedAuthenticationMethodException(authenticationMethod, targetService.getId()); } } final MultiFactorAuthenticationSupportingWebApplicationService svc = new DefaultMultiFactorAuthenticationSupportingWebApplicationService( targetService.getId(), targetService.getId(), targetService.getArtifactId(), getHttpClientIfSingleSignOutEnabled(), authenticationMethod); logger.debug("Created multifactor authentication request for with as [{}].", svc.getId(), MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD, svc.getAuthenticationMethod()); return svc; }

Target:
protected WebApplicationService extractServiceInternal(final HttpServletRequest request) { logger.debug("Attempting to extract multifactor authentication parameters from the request"); WebApplicationService targetService = null; for (final ArgumentExtractor extractor : this.supportedArgumentExtractors) { targetService = extractor.extractService(request); if (targetService != null) { logger.debug("[{}] intercepted the request successfully for multifactor authentication", extractor); break; } } if (targetService == null) { logger.debug("Request is unable to identify the target application"); return null; } final String authenticationMethod = request.getParameter(MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD); if (!StringUtils.hasText(authenticationMethod)) { logger.debug("Request has no request parameter [{}]", MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD); return null; } if (!supportedAuthenticationMethods.contains(authenticationMethod)) { logger.debug("CAS is not configured to support parameter value [{}].", MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD, authenticationMethod); if (request.getAttribute(UnrecognizedAuthenticationMethodException.class.getName()) == null) { request.setAttribute(UnrecognizedAuthenticationMethodException.class.getName(), Boolean.TRUE.toString()); throw new UnrecognizedAuthenticationMethodException(authenticationMethod, targetService.getId()); } } final MultiFactorAuthenticationSupportingWebApplicationService svc = new DefaultMultiFactorAuthenticationSupportingWebApplicationService( targetService.getId(), targetService.getId(), targetService.getArtifactId(), getHttpClientIfSingleSignOutEnabled(), authenticationMethod); logger.debug("Created multifactor authentication request for with as [{}].", svc.getId(), MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD, svc.getAuthenticationMethod()); return svc; }