org.apache.shale.util
Class TokenProcessor

java.lang.Object
  extended by org.apache.shale.util.TokenProcessor

public class TokenProcessor
extends Object

Utility methods supporting the generation and validation of transaction tokens, used to avoid duplicate form submits.

$Id: TokenProcessor.java 464373 2006-10-16 04:21:54Z rahul $


Constructor Summary
TokenProcessor()
           
 
Method Summary
 String generate(javax.faces.context.FacesContext context)
          Generate and return the next transaction token value, and store it so that it may be verified on a subsequent form submit.
 boolean verify(javax.faces.context.FacesContext context, String token)
          Verify that the specified transaction token value (retrieved from an incoming request) is a valid transaaction token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenProcessor

public TokenProcessor()
Method Detail

generate

public String generate(javax.faces.context.FacesContext context)

Generate and return the next transaction token value, and store it so that it may be verified on a subsequent form submit.

Parameters:
context - FacesContext for the current request

verify

public boolean verify(javax.faces.context.FacesContext context,
                      String token)

Verify that the specified transaction token value (retrieved from an incoming request) is a valid transaaction token. In addition, remove it from any stored cache of tokens, so that it may not be reused.

Parameters:
context - FacesContext for the current request
token - Transaction token to be verified
Returns:
True if this token has been verified, else false


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.