<commit_before>function (user, context, callback) {
  // AAI (AUTHENTICATOR ASSURANCE INDICATOR)
  // Sets the AAI for the user. This is later used by the AccessRules.js rule for example

  user.aai = [];
  if ((context.connection === 'github') && (user.two_factor_authentication === true)) {
    Array.prototype.push.apply(user.aai, ["2FA"]);
  } else if ((context.connection === 'firefoxaccounts') && (user.fxa_twoFactorAuthentication === true)) {
    Array.prototype.push.apply(user.aai, ["2FA"]);
  } else if ((context.connectionStrategy === 'ad') && (user.multifactor[0] === "duo")) {
    Array.prototype.push.apply(user.aai, ["2FA"]);
  } else if (context.connection === 'google-oauth2') {
    // We set Google to HIGH_ASSURANCE_IDP which is a special indicator, this is what it represents:
    // - has fraud detection
    // - will inform users when their account is used or logged through push notifications on their devices
    // - will actively block detected fraudulous logins even with correct credentials
    // - will fallback to phone 2FA in most cases (old accounts may still bypass that in some cases)
    // - will fallback to phone 2FA on all recent accounts
    // Note that this is not the same as "2FA" and other indicators, as we simply do not have a technically accurate
    // indicator of what the authenticator supports at this time for Google accounts
    Array.prototype.push.apply(user.aai, ["HIGH_ASSURANCE_IDP"]);
  } else {
    // Ensure all users have some AAI attribute, even if its empty
    user.aai = user.aai || [];
  }
  callback(null, user, context);
}
<commit_msg>if the multifactor context is set, it means the user will be required to duo-authenticate next if the multifactor user attribute is set, it means the user *has* authenticate with duo.<commit_after>function (user, context, callback) {
  // AAI (AUTHENTICATOR ASSURANCE INDICATOR)
  // Sets the AAI for the user. This is later used by the AccessRules.js rule for example

  user.aai = [];
  if ((context.connection === 'github') && (user.two_factor_authentication === true)) {
    Array.prototype.push.apply(user.aai, ["2FA"]);
  } else if ((context.connection === 'firefoxaccounts') && (user.fxa_twoFactorAuthentication === true)) {
    Array.prototype.push.apply(user.aai, ["2FA"]);
  } else if ((context.connectionStrategy === 'ad') && (context.multifactor || user.multifactor[0] === "duo")) {
    Array.prototype.push.apply(user.aai, ["2FA"]);
  } else if (context.connection === 'google-oauth2') {
    // We set Google to HIGH_ASSURANCE_IDP which is a special indicator, this is what it represents:
    // - has fraud detection
    // - will inform users when their account is used or logged through push notifications on their devices
    // - will actively block detected fraudulous logins even with correct credentials
    // - will fallback to phone 2FA in most cases (old accounts may still bypass that in some cases)
    // - will fallback to phone 2FA on all recent accounts
    // Note that this is not the same as "2FA" and other indicators, as we simply do not have a technically accurate
    // indicator of what the authenticator supports at this time for Google accounts
    Array.prototype.push.apply(user.aai, ["HIGH_ASSURANCE_IDP"]);
  } else {
    // Ensure all users have some AAI attribute, even if its empty
    user.aai = user.aai || [];
  }
  callback(null, user, context);
}

{'fraction_non_alphanumeric': 0.1146963919037841, 'fraction_numerical': 0.004693458492226459, 'mean_word_length': 3.6331521739130435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6833742', 'n_tokens_mistral': 987, 'n_tokens_neox': 970, 'n_words': 379}