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 std::string business_center_code;
33};
34
35struct login_request {
36 using response_type = struct login_response;
37 static constexpr std::string_view nats_subject = "iam.v1.auth.login";
38 std::string principal;
39 std::string password;
40};
41
42struct login_response {
43 bool success = false;
44 std::string account_id;
45 std::string tenant_id;
46 std::string tenant_name;
47 std::string username;
48 std::string email;
49 bool password_reset_required = false;
50 bool tenant_bootstrap_mode = false;
51 bool party_setup_required = false;
52 std::string token;
53 std::string error_message;
54 std::string message;
55 std::string selected_party_id;
56 std::vector<party_summary> available_parties;
63 int access_lifetime_s = 1800;
71 std::string session_id;
72};
73
74struct logout_request {
75 using response_type = struct logout_response;
76 static constexpr std::string_view nats_subject = "iam.v1.auth.logout";
77};
78
79struct logout_response {
80 bool success = false;
81 std::string message;
82};
83
84struct public_key_request {
85 static constexpr std::string_view nats_subject = "iam.v1.auth.public-key";
86};
87
95 using response_type = struct refresh_response;
96 static constexpr std::string_view nats_subject = "iam.v1.auth.refresh";
97};
98
103 bool success = false;
104 std::string token;
105 std::string message;
112};
113
128 using response_type = struct service_login_response;
129 static constexpr std::string_view nats_subject = "iam.v1.auth.service-login";
130 std::string username;
131 std::string password;
132};
133
134struct service_login_response {
135 bool success = false;
136 std::string token;
137 std::string message;
138 int access_lifetime_s = 1800;
139};
140
141}
142
143#endif
Request to refresh a JWT token.
Definition login_protocol.hpp:94
Response to a token refresh request.
Definition login_protocol.hpp:102
int access_lifetime_s
Token lifetime in seconds for the newly issued token.
Definition login_protocol.hpp:111
Authenticates a service account and issues a JWT.
Definition login_protocol.hpp:127