Package org.expressme.openid

Examples of org.expressme.openid.OpenIdException


  /**
   * Taken from org.expressme.openid.MainServlet
   */
  private void checkNonce(String nonce) {
    // check response_nonce to prevent replay-attack:
    if (nonce==null || nonce.length()<20) throw new OpenIdException("Verify failed.");
    long nonceTime = getNonceTime(nonce);
    long diff = System.currentTimeMillis() - nonceTime;
    if (diff < 0) diff = (-diff);
    if (diff > ONE_HOUR) throw new OpenIdException("Bad nonce time.");
    if (isNonceExist(nonce)) throw new OpenIdException("Verify nonce failed.");
    storeNonce(nonce, nonceTime + TWO_HOUR);
  }
View Full Code Here


   */
  private long getNonceTime(String nonce) {
    try {
      return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse(nonce.substring(0,19)+"+0000").getTime();
    } catch(ParseException e) {
      throw new OpenIdException("Bad nonce time.");
    }
  }
View Full Code Here

TOP

Related Classes of org.expressme.openid.OpenIdException

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.