diff --git a/src/rest/QueryBuilder.php b/src/rest/QueryBuilder.php index 85a3bb0..acd8f00 100644 --- a/src/rest/QueryBuilder.php +++ b/src/rest/QueryBuilder.php @@ -14,12 +14,21 @@ class QueryBuilder extends \hiqdev\hiart\AbstractQueryBuilder { + protected $authHeaders = []; + /** * This function is for you to provide your authentication. * @param Query $query */ public function buildAuth(Query $query) { + $auth = $this->db->getAuth(); + if (isset($auth['headerToken'])) { + $authHeaders['Authorization'] = 'token ' . $auth['headerToken']; + } + if (isset($auth['headerBearer'])) { + $authHeaders['Authorization'] = 'Bearer ' . $auth['headerBearer']; + } } public function buildMethod(Query $query) @@ -45,7 +54,7 @@ public function buildUri(Query $query) public function buildHeaders(Query $query) { - return []; + return $this->authHeaders; } public function buildProtocolVersion(Query $query)