code: public String createToken(CmsObject cms) throws CmsException {
  
          CmsUser user = cms.getRequestContext().getCurrentUser();
          String key = RandomStringUtils.randomAlphanumeric(16);
          Token tokenObj = new Token(user.getName(), key);
          String token = tokenObj.encode();
          String addInfoKey = tokenObj.getAdditionalInfoKey();
          String value = "" + (System.currentTimeMillis() + m_lifetime);
          user.getAdditionalInfo().put(addInfoKey, value);
          removeExpiredTokens(user, System.currentTimeMillis());
          LOG.info("Generated token for user " + user.getName() + " using key " + key);
          m_adminCms.writeUser(user);
  
          return token;
      }
docs: Generates a new login token for a given user and registers the token in the user's additional info.<p>
  
  @param cms the CMS context for which to create a new token
  @return the generated token
  
  @throws CmsException if something goes wrong