REST_Controller::_force_login PHP Метод

_force_login() защищенный Метод

Force logging in by setting the WWW-Authenticate header
protected _force_login ( string $nonce = '' ) : void
$nonce string A server-specified data string which should be uniquely generated each time
Результат void
    protected function _force_login($nonce = '')
    {
        $rest_auth = $this->config->item('rest_auth');
        $rest_realm = $this->config->item('rest_realm');
        if (strtolower($rest_auth) === 'basic') {
            // See http://tools.ietf.org/html/rfc2617#page-5
            header('WWW-Authenticate: Basic realm="' . $rest_realm . '"');
        } elseif (strtolower($rest_auth) === 'digest') {
            // See http://tools.ietf.org/html/rfc2617#page-18
            header('WWW-Authenticate: Digest realm="' . $rest_realm . '", qop="auth", nonce="' . $nonce . '", opaque="' . md5($rest_realm) . '"');
        }
        // Display an error response
        $this->response([$this->config->item('rest_status_field_name') => FALSE, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_unauthorized')], self::HTTP_UNAUTHORIZED);
    }