Package org.openqreg.bean

Examples of org.openqreg.bean.Token


   * @return a boolean, true if token is ok, else false
   */
  protected boolean checkToken(String sessionId, String externalToken) {
    this.getReadLockTokenTable();
    try {
      Token token = tokens.get(sessionId);
      if (null == token) {
        // no token for this sessionId
        return false;
      }
      if (!token.getTokenString().equals(externalToken)) {
        // no match external and internal token
        return false;
      }
      if ((tokenMaxLifeTime * 60000) < (new Date().getTime() - token
          .getIssuedTimeStamp().getTime())) {
        // token has passed maxLifeTime
        return false;
      }
      // token, match, still valid
View Full Code Here


   * @param sessionId
   *            the sessionId to create and store a token for
   * @return String the new tokenString
   */
  public String getNewTokenString(String sessionId) {
    Token token = new Token();
    token.setIssuedTimeStamp(new Date());
    token.setTokenString(generateRandom());
    this.getWriteLockTokenTable();
    try {
      tokens.put(sessionId, token);
      return token.getTokenString();
    } finally {
      this.releaseWriteLockTokenTable();
    }
  }
View Full Code Here

TOP

Related Classes of org.openqreg.bean.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.