Source:
protected WebApplicationService extractServiceInternal(final HttpServletRequest request) { logger.debug("Attempting to extract multifactor authentication method from registered service attribute..."); final WebApplicationService targetService = getTargetService(request); if (targetService == null) { return null; } final RegisteredService registeredService = this.servicesManager.findServiceBy(targetService); if (registeredService == null) { logger.debug("No registered service is found. Delegating to 'MultiFactorAuthenticationArgumentExtractor'..."); return this.delegateMfaArgumentExtractor.extractServiceInternal(request); } if (!(registeredService instanceof RegisteredServiceWithAttributes)) { logger.debug("Registered service is not capable of defining an mfa attribute. Delegating to 'MultiFactorAuthenticationArgumentExtractor'..."); return this.delegateMfaArgumentExtractor.extractServiceInternal(request); } final String authenticationMethod = String.class.cast(RegisteredServiceWithAttributes.class.cast(registeredService).getExtraAttributes().get(CONST_PARAM_AUTHN_METHOD)); if (!StringUtils.hasText(authenticationMethod)) { logger.debug("Registered service does not define authentication method attribute [{}]. Delegating to 'MultiFactorAuthenticationArgumentExtractor'...", CONST_PARAM_AUTHN_METHOD); return this.delegateMfaArgumentExtractor.extractServiceInternal(request); } verifyAuthenticationMethod(authenticationMethod, targetService, request); final MultiFactorAuthenticationSupportingWebApplicationService svc = new DefaultMultiFactorAuthenticationSupportingWebApplicationService( targetService.getId(), targetService.getId(), targetService.getArtifactId(), getHttpClientIfSingleSignOutEnabled(), authenticationMethod, AuthenticationMethodSource.REGISTERED_SERVICE_DEFINITION); logger.debug("Created multifactor authentication request for with as [{}].", svc.getId(), CONST_PARAM_AUTHN_METHOD, svc.getAuthenticationMethod()); return svc; }

Target:
protected WebApplicationService extractServiceInternal(final HttpServletRequest request) { logger.debug("Attempting to extract multifactor authentication method from registered service attribute..."); final WebApplicationService targetService = getTargetService(request); if (targetService == null) { return null; } final RegisteredService registeredService = this.servicesManager.findServiceBy(targetService); if (registeredService == null) { logger.debug("No registered service is found. Delegating to the next argument extractor in the chain..."); return null; } if (!(registeredService instanceof RegisteredServiceWithAttributes)) { logger.debug("Registered service is not capable of defining an mfa attribute. Delegating to the next argument extractor in the chain..."); return null; } final String authenticationMethod = String.class.cast(RegisteredServiceWithAttributes.class.cast(registeredService).getExtraAttributes().get(CONST_PARAM_AUTHN_METHOD)); if (!StringUtils.hasText(authenticationMethod)) { logger.debug("Registered service does not define authentication method attribute [{}]. Delegating to the next argument extractor in the chain...", CONST_PARAM_AUTHN_METHOD); return null; } verifyAuthenticationMethod(authenticationMethod, targetService, request); final MultiFactorAuthenticationSupportingWebApplicationService svc = new DefaultMultiFactorAuthenticationSupportingWebApplicationService( targetService.getId(), targetService.getId(), targetService.getArtifactId(), getHttpClientIfSingleSignOutEnabled(), authenticationMethod, AuthenticationMethodSource.REGISTERED_SERVICE_DEFINITION); logger.debug("Created multifactor authentication request for with as and authentication method definition source [{}].", svc.getId(), CONST_PARAM_AUTHN_METHOD, svc.getAuthenticationMethod(), AuthenticationMethodSource.REGISTERED_SERVICE_DEFINITION); return svc; }