<commit_before>package net.unicon.cas.mfa.web.flow;

import net.unicon.cas.addons.authentication.AuthenticationSupport;
import net.unicon.cas.mfa.web.flow.util.MultiFactorRequestContextUtils;
import net.unicon.cas.mfa.web.support.MultiFactorAuthenticationSupportingWebApplicationService;

import org.apache.commons.lang.StringUtils;
import org.jasig.cas.authentication.Authentication;
import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.web.support.WebUtils;
import org.springframework.webflow.action.AbstractAction;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;

/**
 * Determines whether the login flow needs to branch *now* to honor the authentication method requirements of
 * {@link MultiFactorAuthenticationSupportingWebApplicationService}.
 *
 * If the Service expresses a requirement for how the user must authenticate,
 * and there's an existing single sign-on session, and there is not a record in the user's
 * single sign-on session of having already fulfilled that requirement, then fires the `requireMfa` event indicating
 * that exceptional handling is required.  Otherwise (i.e., if no exceptional authentication method is required,
 * or there is no existing single sign-on session,
 * or the required exceptional authentication method is already fulfilled) then fire the `requireTgt` event indicating
 * that the login flow should proceed as per normal.
 *
 * More explicitly:
 *
 * <p>
 * <ol>
 *  <li>If an authentication context does not exist
 *  (i.e., the user does not have an existing single sign-on session with a record of a prior authentication),
 *  continue the login flow as usual by firing the `requireTgt` event.</li>
 *  <li>If an authentication context exists without any authentication method decoration, fire the
 *  `requireMfa` event indicating that an exceptional flow is required to fulfill the service's authentication
 *  requirements</li>
 *  <li>If an authentication context exists with an authentication method decoration indicating an authentication
 *  method other than that required by the service, fire the `requireMfa` event indicating that an exceptional flow
 *  is required to fulfill the service's authentication requirements.</li>
 *  <li>Otherwise, fire the `requireTgt` event to continue the login flow as per usual.</li>
 * </ol>
 *
 * This means that in the case where there is not an existing single sign-on session, this Action will continue
 * the login flow as per normal <strong></strong>even though additional authentication will be required
 * later in the flow to fulfill the authentication requirements of the CAS-using service</strong>.
 *
 * @author <NAME>
 */
public final class ValidateInitialMultiFactorAuthenticationRequestAction extends AbstractAction {
<commit_msg>Fix mismatched <strong> tags in JavaDoc<commit_after>package net.unicon.cas.mfa.web.flow;

import net.unicon.cas.addons.authentication.AuthenticationSupport;
import net.unicon.cas.mfa.web.flow.util.MultiFactorRequestContextUtils;
import net.unicon.cas.mfa.web.support.MultiFactorAuthenticationSupportingWebApplicationService;

import org.apache.commons.lang.StringUtils;
import org.jasig.cas.authentication.Authentication;
import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.web.support.WebUtils;
import org.springframework.webflow.action.AbstractAction;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;

/**
 * Determines whether the login flow needs to branch *now* to honor the authentication method requirements of
 * {@link MultiFactorAuthenticationSupportingWebApplicationService}.
 *
 * If the Service expresses a requirement for how the user must authenticate,
 * and there's an existing single sign-on session, and there is not a record in the user's
 * single sign-on session of having already fulfilled that requirement, then fires the `requireMfa` event indicating
 * that exceptional handling is required.  Otherwise (i.e., if no exceptional authentication method is required,
 * or there is no existing single sign-on session,
 * or the required exceptional authentication method is already fulfilled) then fire the `requireTgt` event indicating
 * that the login flow should proceed as per normal.
 *
 * More explicitly:
 *
 * <p>
 * <ol>
 *  <li>If an authentication context does not exist
 *  (i.e., the user does not have an existing single sign-on session with a record of a prior authentication),
 *  continue the login flow as usual by firing the `requireTgt` event.</li>
 *  <li>If an authentication context exists without any authentication method decoration, fire the
 *  `requireMfa` event indicating that an exceptional flow is required to fulfill the service's authentication
 *  requirements</li>
 *  <li>If an authentication context exists with an authentication method decoration indicating an authentication
 *  method other than that required by the service, fire the `requireMfa` event indicating that an exceptional flow
 *  is required to fulfill the service's authentication requirements.</li>
 *  <li>Otherwise, fire the `requireTgt` event to continue the login flow as per usual.</li>
 * </ol>
 *
 * This means that in the case where there is not an existing single sign-on session, this Action will continue
 * the login flow as per normal <strong>even though additional authentication will be required
 * later in the flow to fulfill the authentication requirements of the CAS-using service</strong>.
 *
 * @author <NAME>
 */
public final class ValidateInitialMultiFactorAuthenticationRequestAction extends AbstractAction {

{'fraction_non_alphanumeric': 0.0694566555301565, 'fraction_numerical': 0.0, 'mean_word_length': 5.122712594187298, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2022051', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1369, 'n_words': 607}