authentik_client/models/
o_auth_source.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.12.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// OAuthSource : OAuth Source Serializer
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OAuthSource {
17    #[serde(rename = "pk")]
18    pub pk: uuid::Uuid,
19    /// Source's display Name.
20    #[serde(rename = "name")]
21    pub name: String,
22    /// Internal source name, used in URLs.
23    #[serde(rename = "slug")]
24    pub slug: String,
25    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
26    pub enabled: Option<bool>,
27    /// When enabled, this source will be displayed as a prominent button on the login page, instead of a small icon.
28    #[serde(rename = "promoted", skip_serializing_if = "Option::is_none")]
29    pub promoted: Option<bool>,
30    /// Flow to use when authenticating existing users.
31    #[serde(
32        rename = "authentication_flow",
33        default,
34        with = "::serde_with::rust::double_option",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub authentication_flow: Option<Option<uuid::Uuid>>,
38    /// Flow to use when enrolling new users.
39    #[serde(
40        rename = "enrollment_flow",
41        default,
42        with = "::serde_with::rust::double_option",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub enrollment_flow: Option<Option<uuid::Uuid>>,
46    #[serde(rename = "user_property_mappings", skip_serializing_if = "Option::is_none")]
47    pub user_property_mappings: Option<Vec<uuid::Uuid>>,
48    #[serde(rename = "group_property_mappings", skip_serializing_if = "Option::is_none")]
49    pub group_property_mappings: Option<Vec<uuid::Uuid>>,
50    /// Get object component so that we know how to edit the object
51    #[serde(rename = "component")]
52    pub component: String,
53    /// Return object's verbose_name
54    #[serde(rename = "verbose_name")]
55    pub verbose_name: String,
56    /// Return object's plural verbose_name
57    #[serde(rename = "verbose_name_plural")]
58    pub verbose_name_plural: String,
59    /// Return internal model name
60    #[serde(rename = "meta_model_name")]
61    pub meta_model_name: String,
62    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
63    pub policy_engine_mode: Option<models::PolicyEngineMode>,
64    /// How the source determines if an existing user should be authenticated or a new user enrolled.
65    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
66    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
67    /// Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.
68    #[serde(rename = "managed", deserialize_with = "Option::deserialize")]
69    pub managed: Option<String>,
70    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
71    pub user_path_template: Option<String>,
72    #[serde(rename = "icon", skip_serializing_if = "Option::is_none")]
73    pub icon: Option<String>,
74    #[serde(rename = "icon_url", deserialize_with = "Option::deserialize")]
75    pub icon_url: Option<String>,
76    /// How the source determines if an existing group should be used or a new group created.
77    #[serde(rename = "group_matching_mode", skip_serializing_if = "Option::is_none")]
78    pub group_matching_mode: Option<models::GroupMatchingModeEnum>,
79    #[serde(rename = "provider_type")]
80    pub provider_type: models::ProviderTypeEnum,
81    /// URL used to request the initial token. This URL is only required for OAuth 1.
82    #[serde(
83        rename = "request_token_url",
84        default,
85        with = "::serde_with::rust::double_option",
86        skip_serializing_if = "Option::is_none"
87    )]
88    pub request_token_url: Option<Option<String>>,
89    /// URL the user is redirect to to conest the flow.
90    #[serde(
91        rename = "authorization_url",
92        default,
93        with = "::serde_with::rust::double_option",
94        skip_serializing_if = "Option::is_none"
95    )]
96    pub authorization_url: Option<Option<String>>,
97    /// URL used by authentik to retrieve tokens.
98    #[serde(
99        rename = "access_token_url",
100        default,
101        with = "::serde_with::rust::double_option",
102        skip_serializing_if = "Option::is_none"
103    )]
104    pub access_token_url: Option<Option<String>>,
105    /// URL used by authentik to get user information.
106    #[serde(
107        rename = "profile_url",
108        default,
109        with = "::serde_with::rust::double_option",
110        skip_serializing_if = "Option::is_none"
111    )]
112    pub profile_url: Option<Option<String>>,
113    #[serde(rename = "pkce", skip_serializing_if = "Option::is_none")]
114    pub pkce: Option<models::PkceMethodEnum>,
115    #[serde(rename = "consumer_key")]
116    pub consumer_key: String,
117    /// Get OAuth Callback URL
118    #[serde(rename = "callback_url")]
119    pub callback_url: String,
120    #[serde(rename = "additional_scopes", skip_serializing_if = "Option::is_none")]
121    pub additional_scopes: Option<String>,
122    #[serde(rename = "type")]
123    pub r#type: models::SourceType,
124    #[serde(rename = "oidc_well_known_url", skip_serializing_if = "Option::is_none")]
125    pub oidc_well_known_url: Option<String>,
126    #[serde(rename = "oidc_jwks_url", skip_serializing_if = "Option::is_none")]
127    pub oidc_jwks_url: Option<String>,
128    #[serde(rename = "oidc_jwks", skip_serializing_if = "Option::is_none")]
129    pub oidc_jwks: Option<std::collections::HashMap<String, serde_json::Value>>,
130    /// How to perform authentication during an authorization_code token request flow
131    #[serde(rename = "authorization_code_auth_method", skip_serializing_if = "Option::is_none")]
132    pub authorization_code_auth_method: Option<models::AuthorizationCodeAuthMethodEnum>,
133}
134
135impl OAuthSource {
136    /// OAuth Source Serializer
137    pub fn new(
138        pk: uuid::Uuid,
139        name: String,
140        slug: String,
141        component: String,
142        verbose_name: String,
143        verbose_name_plural: String,
144        meta_model_name: String,
145        managed: Option<String>,
146        icon_url: Option<String>,
147        provider_type: models::ProviderTypeEnum,
148        consumer_key: String,
149        callback_url: String,
150        r#type: models::SourceType,
151    ) -> OAuthSource {
152        OAuthSource {
153            pk,
154            name,
155            slug,
156            enabled: None,
157            promoted: None,
158            authentication_flow: None,
159            enrollment_flow: None,
160            user_property_mappings: None,
161            group_property_mappings: None,
162            component,
163            verbose_name,
164            verbose_name_plural,
165            meta_model_name,
166            policy_engine_mode: None,
167            user_matching_mode: None,
168            managed,
169            user_path_template: None,
170            icon: None,
171            icon_url,
172            group_matching_mode: None,
173            provider_type,
174            request_token_url: None,
175            authorization_url: None,
176            access_token_url: None,
177            profile_url: None,
178            pkce: None,
179            consumer_key,
180            callback_url,
181            additional_scopes: None,
182            r#type,
183            oidc_well_known_url: None,
184            oidc_jwks_url: None,
185            oidc_jwks: None,
186            authorization_code_auth_method: None,
187        }
188    }
189}