Ejemplo n.º 1
0
  /**
   * Build a token from the given state.
   *
   * @return
   */
  public String encodeToken() {
    ManagementContainer mc = ManagementContainer.getInstance();
    SessionValidationManager svm = mc.getSessionValidationManager();

    int rnd = 0;
    if (s_sr != null) {
      // Add some randomness to the payload.
      // Without this, tokens generated w/ the same userId and tz
      // match around the first 90 bytes.  With the rnd the 1st
      // 20 bytes match.
      rnd = s_sr.nextInt();
    }
    String payload = rnd + "," + getUserId() + "," + getTimeZoneOffsetMin();
    String token = svm.createLocalToken(TOKEN_PURPOSE, payload);
    return token;
  }
Ejemplo n.º 2
0
 private String createTicket(String purpose, String email) {
   SessionValidationManager svm = ManagementContainer.getInstance().getSessionValidationManager();
   return svm.createLocalToken(purpose, email);
 }