master
h 21 lines 688 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_HTTP_AUTH_H
4 #define NETDATA_HTTP_AUTH_H
5
6 #include "web_api.h"
7
8 struct web_client;
9
10 extern bool netdata_is_protected_by_bearer;
11
12 bool extract_bearer_token_from_request(struct web_client *w, char *dst, size_t dst_len);
13
14 time_t bearer_create_token(nd_uuid_t *uuid, HTTP_USER_ROLE user_role, HTTP_ACCESS access, nd_uuid_t cloud_account_id, const char *client_name);
15 bool web_client_bearer_token_auth(struct web_client *w, const char *v);
16
17 static inline bool http_access_user_has_enough_access_level_for_endpoint(HTTP_ACCESS user, HTTP_ACCESS endpoint) {
18 return ((user & endpoint) == endpoint);
19 }
20
21 #endif //NETDATA_HTTP_AUTH_H