81 [[nodiscard]]
static auto& lg() {
83 static auto instance = make_logger(
84 "ores.iam.messaging.accounts_message_handler");
100 std::shared_ptr<variability::service::system_flags_service> system_flags,
101 std::shared_ptr<comms::service::auth_session_service> sessions,
102 std::shared_ptr<service::authorization_service> auth_service,
103 std::shared_ptr<geo::service::geolocation_service> geo_service,
106 using handler_result = boost::asio::awaitable<
107 std::expected<std::vector<std::byte>, ores::utility::serialization::error_code>
120 std::span<const std::byte> payload,
121 const std::string& remote_address)
override;
130 handle_save_account_request(std::span<const std::byte> payload,
131 const std::string& remote_address);
139 handle_get_accounts_request(std::span<const std::byte> payload,
140 const std::string& remote_address);
148 handle_list_login_info_request(std::span<const std::byte> payload,
149 const std::string& remote_address);
155 handle_login_request(std::span<const std::byte> payload,
156 const std::string& remote_address);
164 handle_lock_account_request(std::span<const std::byte> payload,
165 const std::string& remote_address);
173 handle_unlock_account_request(std::span<const std::byte> payload,
174 const std::string& remote_address);
182 handle_delete_account_request(std::span<const std::byte> payload,
183 const std::string& remote_address);
191 handle_create_initial_admin_request(std::span<const std::byte> payload,
192 const std::string& remote_address);
200 handle_bootstrap_status_request(std::span<const std::byte> payload);
208 handle_logout_request(std::span<const std::byte> payload,
209 const std::string& remote_address);
217 handle_get_account_history_request(std::span<const std::byte> payload,
218 const std::string& remote_address);
227 handle_reset_password_request(std::span<const std::byte> payload,
228 const std::string& remote_address);
237 handle_change_password_request(std::span<const std::byte> payload,
238 const std::string& remote_address);
246 handle_update_my_email_request(std::span<const std::byte> payload,
247 const std::string& remote_address);
256 handle_signup_request(std::span<const std::byte> payload);
268 handle_list_roles_request(std::span<const std::byte> payload,
269 const std::string& remote_address);
277 handle_list_permissions_request(std::span<const std::byte> payload,
278 const std::string& remote_address);
286 handle_get_role_request(std::span<const std::byte> payload,
287 const std::string& remote_address);
295 handle_assign_role_request(std::span<const std::byte> payload,
296 const std::string& remote_address);
304 handle_revoke_role_request(std::span<const std::byte> payload,
305 const std::string& remote_address);
313 handle_get_account_roles_request(std::span<const std::byte> payload,
314 const std::string& remote_address);
322 handle_get_account_permissions_request(std::span<const std::byte> payload,
323 const std::string& remote_address);
331 static bool is_localhost(
const std::string& remote_address);
338 using auth_check_result = std::expected<
340 ores::utility::serialization::error_code
354 auth_check_result check_authorization(
355 const std::string& remote_address,
356 std::string_view permission,
357 std::string_view operation_name);
368 auth_check_result get_authenticated_session(
369 const std::string& remote_address,
370 std::string_view operation_name);
379 handle_list_sessions_request(std::span<const std::byte> payload,
380 const std::string& remote_address);
389 handle_get_session_statistics_request(std::span<const std::byte> payload,
390 const std::string& remote_address);
399 handle_get_active_sessions_request(std::span<const std::byte> payload,
400 const std::string& remote_address);
404 std::shared_ptr<variability::service::system_flags_service> system_flags_;
405 std::shared_ptr<comms::service::auth_session_service> sessions_;
406 std::shared_ptr<service::authorization_service> auth_service_;
409 std::shared_ptr<geo::service::geolocation_service> geo_service_;