public static final void validateToken ( AuthToken token ) throws IllegalArgumentException { if ( token . getExpiresOn ( ) . before ( new Date ( ) ) ) { throw new IllegalArgumentException ( "Authentication token expired: " + token . getExpiresOn ( ) ) ; //$NON-NLS-1$ } String validSig = generateSignature ( token ) ; if ( token . getSignature ( ) == null || ! token . getSignature ( ) . equals ( validSig ) ) { throw new IllegalArgumentException ( "Missing or invalid signature on the auth token." ) ; //$NON-NLS-1$ } }
Validates an auth token . This checks the expiration time of the token against the current system time . It also checks the validity of the signature .