code: @Override
      public Result addTokenToResult(Context context, String newToken, Result result) {
          if (isCached(context)) {
              LOGGER.debug("Not adding token to a cached result");
              return result;
          }
  
          LOGGER.debug("Adding token to result");
          if (getCookieName() != null) {
              Cookie cookie = context.cookie(getCookieName());
              if (cookie != null) {
                  return result.with(Cookie.builder(cookie).setValue(newToken).build());
              } else {
                  // Create a new cookie
                  return result.with(Cookie.cookie(getCookieName(), newToken)
                          .setSecure(isSecureCookie())
                          .setPath(getCookiePath())
                          .setDomain(getCookieDomain())
                          .setMaxAge(3600)
                          .build());
              }
          } else {
              // Session
              context.session().put(getTokenName(), newToken);
              return result;
          }
      }
docs: Methods adding the CORS token to the given result. The effect depends on the configuration.
  
  @param context  the context
  @param newToken the new token
  @param result   the result that is enhanced
  @return the updated result