code: public static void trackTrustedMultifactorAuthenticationAttribute(
          final Authentication authn,
          final String attributeName) {
  
          val newAuthn = DefaultAuthenticationBuilder.newInstance(authn)
              .addAttribute(attributeName, Boolean.TRUE)
              .build();
          LOGGER.debug("Updated authentication session to remember trusted multifactor record via [{}]", attributeName);
          authn.update(newAuthn);
      }
docs: Track trusted multifactor authentication attribute.
  
  @param authn         the authn
  @param attributeName the attribute name