Source:
<code>protected WebApplicationService extractServiceInternal(final HttpServletRequest request) { logger.debug("Attempting to extract multifactor authentication parameters from the request"); final String targetService = request.getParameter(CONST_PARAM_TARGET_SERVICE); final String authenticationMethod = request.getParameter(MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD); final String serviceToUse = StringUtils.hasText(targetService) ? targetService : request.getParameter(CONST_PARAM_SERVICE); if (!StringUtils.hasText(serviceToUse)) { logger.debug("Request has no request parameter [{}]", CONST_PARAM_SERVICE); return null; } 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); return null; } <START> final String id = exciseJsessionFromUrl(serviceToUse); <END> final String artifactId = request.getParameter(CONST_PARAM_TICKET); final MultiFactorAuthenticationSupportingWebApplicationService svc = new DefaultMultiFactorAuthenticationSupportingWebApplicationService( id, serviceToUse, artifactId, getHttpClientIfSingleSignOutEnabled(), authenticationMethod); logger.debug("Created multifactor authentication request for with as [{}].", svc.getId(), MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD, svc.getAuthenticationMethod()); return svc; }</code><technical_language>Instead of cleaning URL here, simply pass is constructor of DefaultMultiFactorAuthenticationSupportingWebApplicationService. constructor clean url, access parent's cleanupUrl. duplication</technical_language>

Target:
protected WebApplicationService extractServiceInternal(final HttpServletRequest request) { logger.debug("Attempting to extract multifactor authentication parameters from the request"); final String targetService = request.getParameter(CONST_PARAM_TARGET_SERVICE); final String authenticationMethod = request.getParameter(MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD); final String serviceToUse = StringUtils.hasText(targetService) ? targetService : request.getParameter(CONST_PARAM_SERVICE); if (!StringUtils.hasText(serviceToUse)) { logger.debug("Request has no request parameter [{}]", CONST_PARAM_SERVICE); return null; } 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); return null; } final String artifactId = request.getParameter(CONST_PARAM_TICKET); final MultiFactorAuthenticationSupportingWebApplicationService svc = new DefaultMultiFactorAuthenticationSupportingWebApplicationService( serviceToUse, serviceToUse, artifactId, getHttpClientIfSingleSignOutEnabled(), authenticationMethod); logger.debug("Created multifactor authentication request for with as [{}].", svc.getId(), MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD, svc.getAuthenticationMethod()); return svc; }