authentik_client/models/
o_auth_source.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.8.4
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    /// Flow to use when authenticating existing users.
28    #[serde(
29        rename = "authentication_flow",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub authentication_flow: Option<Option<uuid::Uuid>>,
35    /// Flow to use when enrolling new users.
36    #[serde(
37        rename = "enrollment_flow",
38        default,
39        with = "::serde_with::rust::double_option",
40        skip_serializing_if = "Option::is_none"
41    )]
42    pub enrollment_flow: Option<Option<uuid::Uuid>>,
43    #[serde(rename = "user_property_mappings", skip_serializing_if = "Option::is_none")]
44    pub user_property_mappings: Option<Vec<uuid::Uuid>>,
45    #[serde(rename = "group_property_mappings", skip_serializing_if = "Option::is_none")]
46    pub group_property_mappings: Option<Vec<uuid::Uuid>>,
47    /// Get object component so that we know how to edit the object
48    #[serde(rename = "component")]
49    pub component: String,
50    /// Return object's verbose_name
51    #[serde(rename = "verbose_name")]
52    pub verbose_name: String,
53    /// Return object's plural verbose_name
54    #[serde(rename = "verbose_name_plural")]
55    pub verbose_name_plural: String,
56    /// Return internal model name
57    #[serde(rename = "meta_model_name")]
58    pub meta_model_name: String,
59    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
60    pub policy_engine_mode: Option<models::PolicyEngineMode>,
61    /// How the source determines if an existing user should be authenticated or a new user enrolled.
62    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
63    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
64    /// 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.
65    #[serde(rename = "managed", deserialize_with = "Option::deserialize")]
66    pub managed: Option<String>,
67    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
68    pub user_path_template: Option<String>,
69    #[serde(rename = "icon", deserialize_with = "Option::deserialize")]
70    pub icon: Option<String>,
71    /// How the source determines if an existing group should be used or a new group created.
72    #[serde(rename = "group_matching_mode", skip_serializing_if = "Option::is_none")]
73    pub group_matching_mode: Option<models::GroupMatchingModeEnum>,
74    #[serde(rename = "provider_type")]
75    pub provider_type: models::ProviderTypeEnum,
76    /// URL used to request the initial token. This URL is only required for OAuth 1.
77    #[serde(
78        rename = "request_token_url",
79        default,
80        with = "::serde_with::rust::double_option",
81        skip_serializing_if = "Option::is_none"
82    )]
83    pub request_token_url: Option<Option<String>>,
84    /// URL the user is redirect to to conest the flow.
85    #[serde(
86        rename = "authorization_url",
87        default,
88        with = "::serde_with::rust::double_option",
89        skip_serializing_if = "Option::is_none"
90    )]
91    pub authorization_url: Option<Option<String>>,
92    /// URL used by authentik to retrieve tokens.
93    #[serde(
94        rename = "access_token_url",
95        default,
96        with = "::serde_with::rust::double_option",
97        skip_serializing_if = "Option::is_none"
98    )]
99    pub access_token_url: Option<Option<String>>,
100    /// URL used by authentik to get user information.
101    #[serde(
102        rename = "profile_url",
103        default,
104        with = "::serde_with::rust::double_option",
105        skip_serializing_if = "Option::is_none"
106    )]
107    pub profile_url: Option<Option<String>>,
108    #[serde(rename = "consumer_key")]
109    pub consumer_key: String,
110    /// Get OAuth Callback URL
111    #[serde(rename = "callback_url")]
112    pub callback_url: String,
113    #[serde(rename = "additional_scopes", skip_serializing_if = "Option::is_none")]
114    pub additional_scopes: Option<String>,
115    #[serde(rename = "type")]
116    pub r#type: models::SourceType,
117    #[serde(rename = "oidc_well_known_url", skip_serializing_if = "Option::is_none")]
118    pub oidc_well_known_url: Option<String>,
119    #[serde(rename = "oidc_jwks_url", skip_serializing_if = "Option::is_none")]
120    pub oidc_jwks_url: Option<String>,
121    #[serde(rename = "oidc_jwks", skip_serializing_if = "Option::is_none")]
122    pub oidc_jwks: Option<std::collections::HashMap<String, serde_json::Value>>,
123    /// How to perform authentication during an authorization_code token request flow
124    #[serde(rename = "authorization_code_auth_method", skip_serializing_if = "Option::is_none")]
125    pub authorization_code_auth_method: Option<models::AuthorizationCodeAuthMethodEnum>,
126}
127
128impl OAuthSource {
129    /// OAuth Source Serializer
130    pub fn new(
131        pk: uuid::Uuid,
132        name: String,
133        slug: String,
134        component: String,
135        verbose_name: String,
136        verbose_name_plural: String,
137        meta_model_name: String,
138        managed: Option<String>,
139        icon: Option<String>,
140        provider_type: models::ProviderTypeEnum,
141        consumer_key: String,
142        callback_url: String,
143        r#type: models::SourceType,
144    ) -> OAuthSource {
145        OAuthSource {
146            pk,
147            name,
148            slug,
149            enabled: None,
150            authentication_flow: None,
151            enrollment_flow: None,
152            user_property_mappings: None,
153            group_property_mappings: None,
154            component,
155            verbose_name,
156            verbose_name_plural,
157            meta_model_name,
158            policy_engine_mode: None,
159            user_matching_mode: None,
160            managed,
161            user_path_template: None,
162            icon,
163            group_matching_mode: None,
164            provider_type,
165            request_token_url: None,
166            authorization_url: None,
167            access_token_url: None,
168            profile_url: None,
169            consumer_key,
170            callback_url,
171            additional_scopes: None,
172            r#type,
173            oidc_well_known_url: None,
174            oidc_jwks_url: None,
175            oidc_jwks: None,
176            authorization_code_auth_method: None,
177        }
178    }
179}