public function unauthenticated(ServerRequest $request, Response $response)
    {
        if (!$this->_config['unauthenticatedException']) {
            return;
        }

        $message = $this->_error
            ? $this->_error->getMessage()
            : $this->_registry->get('Auth')->getConfig('authError');

        $exception = new $this->_config['unauthenticatedException']($message);
        throw $exception;
    }
public function unauthenticated(ServerRequest $request, Response $response)
    {
        if (!$this->_config['unauthenticatedException']) {
            return;
        }

        $message = $this->_error
            ? $this->_error->getMessage()
            : $this->_registry->get('Auth')->getConfig('authError');

        $exception = new $this->_config['unauthenticatedException']($message);
        throw $exception;
    }
public function unauthenticated ( ServerRequest $ request , Response $ response ) { if ( ! $ this -> _config [ 'unauthenticatedException' ] ) { return ; } $ message = $ this -> _error ? $ this -> _error -> getMessage ( ) : $ this -> _registry -> get ( 'Auth' ) -> getConfig ( 'authError' ) ; $ exception = new $ this -> _config [ 'unauthenticatedException' ] ( $ message ) ; throw $ exception ; }
Handles an unauthenticated access attempt. Depending on value of config
`unauthenticatedException` either throws the specified exception or returns
null.

@param \Cake\Http\ServerRequest $request A request object.
@param \Cake\Http\Response $response A response object.

@throws \Cake\Http\Exception\UnauthorizedException Or any other
configured exception.

@return void
Handles an unauthenticated access attempt . Depending on value of config unauthenticatedException either throws the specified exception or returns null .