Skip to main content

authentik_client/models/
o_auth_source.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2026.2.0
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    #[serde(rename = "icon_themed_urls", deserialize_with = "Option::deserialize")]
77    pub icon_themed_urls: Option<models::ThemedUrls>,
78    /// How the source determines if an existing group should be used or a new group created.
79    #[serde(rename = "group_matching_mode", skip_serializing_if = "Option::is_none")]
80    pub group_matching_mode: Option<models::GroupMatchingModeEnum>,
81    #[serde(rename = "provider_type")]
82    pub provider_type: models::ProviderTypeEnum,
83    /// URL used to request the initial token. This URL is only required for OAuth 1.
84    #[serde(
85        rename = "request_token_url",
86        default,
87        with = "::serde_with::rust::double_option",
88        skip_serializing_if = "Option::is_none"
89    )]
90    pub request_token_url: Option<Option<String>>,
91    /// URL the user is redirect to to conest the flow.
92    #[serde(
93        rename = "authorization_url",
94        default,
95        with = "::serde_with::rust::double_option",
96        skip_serializing_if = "Option::is_none"
97    )]
98    pub authorization_url: Option<Option<String>>,
99    /// URL used by authentik to retrieve tokens.
100    #[serde(
101        rename = "access_token_url",
102        default,
103        with = "::serde_with::rust::double_option",
104        skip_serializing_if = "Option::is_none"
105    )]
106    pub access_token_url: Option<Option<String>>,
107    /// URL used by authentik to get user information.
108    #[serde(
109        rename = "profile_url",
110        default,
111        with = "::serde_with::rust::double_option",
112        skip_serializing_if = "Option::is_none"
113    )]
114    pub profile_url: Option<Option<String>>,
115    #[serde(rename = "pkce", skip_serializing_if = "Option::is_none")]
116    pub pkce: Option<models::PkceMethodEnum>,
117    #[serde(rename = "consumer_key")]
118    pub consumer_key: String,
119    /// Get OAuth Callback URL
120    #[serde(rename = "callback_url")]
121    pub callback_url: String,
122    #[serde(rename = "additional_scopes", skip_serializing_if = "Option::is_none")]
123    pub additional_scopes: Option<String>,
124    #[serde(rename = "type")]
125    pub r#type: models::SourceType,
126    #[serde(rename = "oidc_well_known_url", skip_serializing_if = "Option::is_none")]
127    pub oidc_well_known_url: Option<String>,
128    #[serde(rename = "oidc_jwks_url", skip_serializing_if = "Option::is_none")]
129    pub oidc_jwks_url: Option<String>,
130    #[serde(rename = "oidc_jwks", skip_serializing_if = "Option::is_none")]
131    pub oidc_jwks: Option<std::collections::HashMap<String, serde_json::Value>>,
132    /// How to perform authentication during an authorization_code token request flow
133    #[serde(rename = "authorization_code_auth_method", skip_serializing_if = "Option::is_none")]
134    pub authorization_code_auth_method: Option<models::AuthorizationCodeAuthMethodEnum>,
135}
136
137impl OAuthSource {
138    /// OAuth Source Serializer
139    pub fn new(
140        pk: uuid::Uuid,
141        name: String,
142        slug: String,
143        component: String,
144        verbose_name: String,
145        verbose_name_plural: String,
146        meta_model_name: String,
147        managed: Option<String>,
148        icon_url: Option<String>,
149        icon_themed_urls: Option<models::ThemedUrls>,
150        provider_type: models::ProviderTypeEnum,
151        consumer_key: String,
152        callback_url: String,
153        r#type: models::SourceType,
154    ) -> OAuthSource {
155        OAuthSource {
156            pk,
157            name,
158            slug,
159            enabled: None,
160            promoted: None,
161            authentication_flow: None,
162            enrollment_flow: None,
163            user_property_mappings: None,
164            group_property_mappings: None,
165            component,
166            verbose_name,
167            verbose_name_plural,
168            meta_model_name,
169            policy_engine_mode: None,
170            user_matching_mode: None,
171            managed,
172            user_path_template: None,
173            icon: None,
174            icon_url,
175            icon_themed_urls,
176            group_matching_mode: None,
177            provider_type,
178            request_token_url: None,
179            authorization_url: None,
180            access_token_url: None,
181            profile_url: None,
182            pkce: None,
183            consumer_key,
184            callback_url,
185            additional_scopes: None,
186            r#type,
187            oidc_well_known_url: None,
188            oidc_jwks_url: None,
189            oidc_jwks: None,
190            authorization_code_auth_method: None,
191        }
192    }
193}