lithium\security\validation\RequestToken::key PHP Method

key() public static method

Generates a single-use key to be embedded in a form or used with another non-idempotent request (a request that changes the state of the server or application), that will match against a client session token using the check() method.
See also: lithium\security\validation\RequestToken::check()
public static key ( array $options = [] ) : string
$options array An array of options to be passed to `RequestToken::get()`.
return string Returns a hashed key string for use with `RequestToken::check()`.
    public static function key(array $options = array())
    {
        return Password::hash(static::get($options));
    }

Usage Example

 /**
  * Tests extracting a key from a `Request` object and matching it against a token.
  */
 public function testTokenFromRequestObject()
 {
     $request = new Request(array('data' => array('security' => array('token' => RequestToken::key()))));
     $this->assertTrue(RequestToken::check($request));
 }
All Usage Examples Of lithium\security\validation\RequestToken::key