diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-17 19:55:36 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-17 19:55:36 +0200 |
| commit | 380195f7cd5e57acf2c1cf2bc41069e6b0b979ed (patch) | |
| tree | 32a88fb22a7fbe8f1fd5c105156d1f928c93950d /src/sessions.h | |
| download | bokf-0.1.0.tar.gz bokf-0.1.0.zip | |
Initial commit: daemon, clients, docs, Docker deploy pipelinev0.1.0
Diffstat (limited to 'src/sessions.h')
| -rw-r--r-- | src/sessions.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sessions.h b/src/sessions.h new file mode 100644 index 0000000..d573b23 --- /dev/null +++ b/src/sessions.h @@ -0,0 +1,28 @@ +#ifndef BOKF_SESSIONS_H +#define BOKF_SESSIONS_H + +#include <stdint.h> + +struct session { + char id[64]; + int64_t user_id; + int is_admin; + int64_t active_org; + int64_t bound_org; /* token sessions are bound to one org; 0 = none */ + int64_t token_id; /* api token used to open the session, 0 for password */ + char scopes[32]; + int64_t created; + int64_t last_seen; + int64_t expires; + struct session *next; +}; + +void sessions_init(long ttl_seconds); +struct session *sessions_create(int64_t user_id, int is_admin, + int64_t active_org, int64_t bound_org, + const char *scopes); +struct session *sessions_get(const char *id); +void sessions_destroy(const char *id); +void sessions_free_all(void); + +#endif |
