public function validateRequest($token)
    {

        // If no token was sent, don't try to _validate it.
        if (empty($token)) {
            $this->_badToken401();
        }

        $validateResponse = $this->_validate($token);

        // If the result is not an array or doesn't contain a subject, send a 401
        if ((!is_array($validateResponse)) || (!array_key_exists('sub', $validateResponse))) {
            $this->_badToken401();
        }

        if (array_key_exists('sub', $validateResponse)) {
            $this->_tokenData = $validateResponse;
            $this->_setPrincipal();
            $this->_setAttributes();
        }

        return true;
    }
public function validateRequest($token)
    {

        // If no token was sent, don't try to _validate it.
        if (empty($token)) {
            $this->_badToken401();
        }

        $validateResponse = $this->_validate($token);

        // If the result is not an array or doesn't contain a subject, send a 401
        if ((!is_array($validateResponse)) || (!array_key_exists('sub', $validateResponse))) {
            $this->_badToken401();
        }

        if (array_key_exists('sub', $validateResponse)) {
            $this->_tokenData = $validateResponse;
            $this->_setPrincipal();
            $this->_setAttributes();
        }

        return true;
    }
public function validateRequest ( $ token ) { // If no token was sent, don't try to _validate it. if ( empty ( $ token ) ) { $ this -> _badToken401 ( ) ; } $ validateResponse = $ this -> _validate ( $ token ) ; // If the result is not an array or doesn't contain a subject, send a 401 if ( ( ! is_array ( $ validateResponse ) ) || ( ! array_key_exists ( 'sub' , $ validateResponse ) ) ) { $ this -> _badToken401 ( ) ; } if ( array_key_exists ( 'sub' , $ validateResponse ) ) { $ this -> _tokenData = $ validateResponse ; $ this -> _setPrincipal ( ) ; $ this -> _setAttributes ( ) ; } return true ; }
Validates a request and returns a 401 when not authorized

@param string $token token to _validate

@return bool
Validates a request and returns a 401 when not authorized