p7m_userauth/models/
authorization_response.rs

1/*
2 * User and Authentication Backend
3 *
4 * # API for authentication and managing user accounts  This is the API of the service at P7M that manages tenants, accounts and authentication. It is the basis of many services of P7M.  The caller has to be authenticated with the system and provide a JWT token in the Authorization header of the HTTP request. When using the API you typically get this token by authenticating first with OAuth 2.0.  When you are trying this API using the Swagger interface, you need to click the `Authorize` button and then again the Authorize button in the pop-up that gets opened.
5 *
6 * The version of the OpenAPI document: 0.14.2
7 * Contact: tech@p7m.de
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct AuthorizationResponse {
16    #[serde(rename = "success")]
17    pub success: bool,
18    #[serde(rename = "jwt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19    pub jwt: Option<Option<String>>,
20    #[serde(rename = "tenantId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
21    pub tenant_id: Option<Option<uuid::Uuid>>,
22    #[serde(rename = "expiration", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
23    pub expiration: Option<Option<String>>,
24    #[serde(rename = "accessibleTenants")]
25    pub accessible_tenants: Vec<models::Tenant>,
26}
27
28impl AuthorizationResponse {
29    pub fn new(success: bool, accessible_tenants: Vec<models::Tenant>) -> AuthorizationResponse {
30        AuthorizationResponse {
31            success,
32            jwt: None,
33            tenant_id: None,
34            expiration: None,
35            accessible_tenants,
36        }
37    }
38}
39