ORE Studio 0.0.4
Loading...
Searching...
No Matches
login_protocol.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_IAM_MESSAGING_LOGIN_PROTOCOL_HPP
21#define ORES_IAM_MESSAGING_LOGIN_PROTOCOL_HPP
22
23#include <string>
24#include <vector>
25
26namespace ores::iam::messaging {
27
28struct party_summary {
29 std::string id;
30 std::string name;
31 std::string party_category;
32};
33
34struct login_request {
35 using response_type = struct login_response;
36 static constexpr std::string_view nats_subject = "iam.v1.auth.login";
37 std::string principal;
38 std::string password;
39};
40
41struct login_response {
42 bool success = false;
43 std::string account_id;
44 std::string tenant_id;
45 std::string tenant_name;
46 std::string username;
47 std::string email;
48 bool password_reset_required = false;
49 bool tenant_bootstrap_mode = false;
50 std::string token;
51 std::string error_message;
52 std::string message;
53 std::string selected_party_id;
54 std::vector<party_summary> available_parties;
61 int access_lifetime_s = 1800;
62};
63
64struct logout_request {
65 using response_type = struct logout_response;
66 static constexpr std::string_view nats_subject = "iam.v1.auth.logout";
67};
68
69struct logout_response {
70 bool success = false;
71 std::string message;
72};
73
74struct public_key_request {
75 static constexpr std::string_view nats_subject = "iam.v1.auth.public-key";
76};
77
85 using response_type = struct refresh_response;
86 static constexpr std::string_view nats_subject = "iam.v1.auth.refresh";
87};
88
93 bool success = false;
94 std::string token;
95 std::string message;
102};
103
118 using response_type = struct service_login_response;
119 static constexpr std::string_view nats_subject = "iam.v1.auth.service-login";
120 std::string username;
121 std::string password;
122};
123
124struct service_login_response {
125 bool success = false;
126 std::string token;
127 std::string message;
128 int access_lifetime_s = 1800;
129};
130
131}
132
133#endif
Request to refresh a JWT token.
Definition login_protocol.hpp:84
Response to a token refresh request.
Definition login_protocol.hpp:92
int access_lifetime_s
Token lifetime in seconds for the newly issued token.
Definition login_protocol.hpp:101
Authenticates a service account and issues a JWT.
Definition login_protocol.hpp:117