public function verifyServerNonce($snonce, $ip_address = '127.0.0.1')
    {
        $snonce_cache_key = 'snonce__'.$snonce;

        if (empty($this->cache)) {
            return;
        }

        $snonce_data = $this->cache->get($snonce_cache_key);
        if (empty($snonce_data)) {
            throw new NonceException('That nonce has been not been generated');
        }
        if ($snonce_data !== $ip_address) {
            throw new NonceException('That nonce has been used elsewhere');
        }

        $this->cache->add($snonce_cache_key, 'USED');
    }
public function verifyServerNonce($snonce, $ip_address = '127.0.0.1')
    {
        $snonce_cache_key = 'snonce__'.$snonce;

        if (empty($this->cache)) {
            return;
        }

        $snonce_data = $this->cache->get($snonce_cache_key);
        if (empty($snonce_data)) {
            throw new NonceException('That nonce has been not been generated');
        }
        if ($snonce_data !== $ip_address) {
            throw new NonceException('That nonce has been used elsewhere');
        }

        $this->cache->add($snonce_cache_key, 'USED');
    }
public function verifyServerNonce ( $ snonce , $ ip_address = '127.0.0.1' ) { $ snonce_cache_key = 'snonce__' . $ snonce ; if ( empty ( $ this -> cache ) ) { return ; } $ snonce_data = $ this -> cache -> get ( $ snonce_cache_key ) ; if ( empty ( $ snonce_data ) ) { throw new NonceException ( 'That nonce has been not been generated' ) ; } if ( $ snonce_data !== $ ip_address ) { throw new NonceException ( 'That nonce has been used elsewhere' ) ; } $ this -> cache -> add ( $ snonce_cache_key , 'USED' ) ; }
Verifies a server nonce.

This ensures that the server nonce has been used once and once only,
and only by the same IP address that it was provided to.

Throws a NonceException if the nonce does not verify (has been used
elsewhere or has never been used).

@param string $snonce     The server nonce key.
@param string $ip_address

@throws NonceException
Verifies a server nonce .