AXIAM C++ SDK 1.0.0-alpha8
Authentication, authorization, JWKS & route guards (REST + mTLS)
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1// Public domain value types returned/accepted by axiam::Client. Mirrors the
2// relevant openapi.json schemas (auth + authz).
3#pragma once
4
5#include <cstdint>
6#include <optional>
7#include <string>
8#include <vector>
9
10#include "axiam/sensitive.hpp"
11
12namespace axiam {
13
15struct UserInfo {
16 std::string id;
17 std::string username;
18 std::string email;
19 std::string tenant_id;
20 std::optional<std::string> org_slug;
21 std::optional<std::string> tenant_slug;
22};
23
28 bool mfa_required = false;
29
30 // Success branch (HTTP 200 LoginSuccessResponse).
31 std::optional<UserInfo> user;
32 std::string session_id;
33 std::int64_t expires_in = 0;
34
35 // MFA-required branch (HTTP 202 MfaRequiredResponse).
40 std::vector<std::string> available_methods;
41};
42
45struct TokenPair {
46 std::int64_t expires_in = 0;
47};
48
51struct DeviceAuth {
53 std::string token_type;
54 std::int64_t expires_in = 0;
55};
56
60 std::string action;
61 std::string resource_id;
62 std::optional<std::string> scope;
63 std::optional<std::string> subject_id;
64};
65
76struct ReasonCode {
78 static constexpr const char* kAllowed = "allowed";
80 static constexpr const char* kNoGrant = "no_grant";
82 static constexpr const char* kDeniedByRule = "denied_by_rule";
83};
84
87 bool allowed = false;
89 std::optional<std::string> reason;
95 std::optional<std::string> reason_code;
96};
97
98} // namespace axiam
Wraps secret material (access tokens, mTLS private keys).
Definition sensitive.hpp:26
Definition authenticator.hpp:40
A single access-check request (CheckAccessBody).
Definition types.hpp:59
std::optional< std::string > subject_id
Definition types.hpp:63
std::optional< std::string > scope
Definition types.hpp:62
std::string action
Definition types.hpp:60
std::string resource_id
Definition types.hpp:61
Result of an access check (CheckAccessResponse).
Definition types.hpp:86
std::optional< std::string > reason_code
§11 rule 9 machine-readable decision reason.
Definition types.hpp:95
std::optional< std::string > reason
Human-readable prose, when the server sends any.
Definition types.hpp:89
bool allowed
Definition types.hpp:87
mTLS device authentication result (POST /api/v1/auth/device).
Definition types.hpp:51
Sensitive< std::string > access_token
Definition types.hpp:52
std::int64_t expires_in
Definition types.hpp:54
std::string token_type
Definition types.hpp:53
Result of login / verify_mfa.
Definition types.hpp:27
std::optional< UserInfo > user
Definition types.hpp:31
bool mfa_required
Definition types.hpp:28
std::vector< std::string > available_methods
Definition types.hpp:40
std::int64_t expires_in
Definition types.hpp:33
Sensitive< std::string > challenge_token
Short-lived MFA challenge token.
Definition types.hpp:39
std::string session_id
Definition types.hpp:32
The three decision reason codes the server currently emits (§11 rule 9).
Definition types.hpp:76
static constexpr const char * kAllowed
An allow grant matched and no deny did.
Definition types.hpp:78
static constexpr const char * kDeniedByRule
An explicit deny rule matched and overrode any allow. An admin already decided.
Definition types.hpp:82
static constexpr const char * kNoGrant
Nothing matched — default deny. Tells the user to ask an admin for access.
Definition types.hpp:80
Result of a token refresh (§9).
Definition types.hpp:45
std::int64_t expires_in
Definition types.hpp:46
Subset of LoginUserInfo returned on a successful authentication.
Definition types.hpp:15
std::optional< std::string > tenant_slug
Definition types.hpp:21
std::string email
Definition types.hpp:18
std::string username
Definition types.hpp:17
std::string id
Definition types.hpp:16
std::string tenant_id
Definition types.hpp:19
std::optional< std::string > org_slug
Definition types.hpp:20