authentik_client/models/
o_auth_source.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.10.2
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 = "pkce", skip_serializing_if = "Option::is_none")]
109    pub pkce: Option<models::PkceMethodEnum>,
110    #[serde(rename = "consumer_key")]
111    pub consumer_key: String,
112    /// Get OAuth Callback URL
113    #[serde(rename = "callback_url")]
114    pub callback_url: String,
115    #[serde(rename = "additional_scopes", skip_serializing_if = "Option::is_none")]
116    pub additional_scopes: Option<String>,
117    #[serde(rename = "type")]
118    pub r#type: models::SourceType,
119    #[serde(rename = "oidc_well_known_url", skip_serializing_if = "Option::is_none")]
120    pub oidc_well_known_url: Option<String>,
121    #[serde(rename = "oidc_jwks_url", skip_serializing_if = "Option::is_none")]
122    pub oidc_jwks_url: Option<String>,
123    #[serde(rename = "oidc_jwks", skip_serializing_if = "Option::is_none")]
124    pub oidc_jwks: Option<std::collections::HashMap<String, serde_json::Value>>,
125    /// How to perform authentication during an authorization_code token request flow
126    #[serde(rename = "authorization_code_auth_method", skip_serializing_if = "Option::is_none")]
127    pub authorization_code_auth_method: Option<models::AuthorizationCodeAuthMethodEnum>,
128}
129
130impl OAuthSource {
131    /// OAuth Source Serializer
132    pub fn new(
133        pk: uuid::Uuid,
134        name: String,
135        slug: String,
136        component: String,
137        verbose_name: String,
138        verbose_name_plural: String,
139        meta_model_name: String,
140        managed: Option<String>,
141        icon: Option<String>,
142        provider_type: models::ProviderTypeEnum,
143        consumer_key: String,
144        callback_url: String,
145        r#type: models::SourceType,
146    ) -> OAuthSource {
147        OAuthSource {
148            pk,
149            name,
150            slug,
151            enabled: None,
152            authentication_flow: None,
153            enrollment_flow: None,
154            user_property_mappings: None,
155            group_property_mappings: None,
156            component,
157            verbose_name,
158            verbose_name_plural,
159            meta_model_name,
160            policy_engine_mode: None,
161            user_matching_mode: None,
162            managed,
163            user_path_template: None,
164            icon,
165            group_matching_mode: None,
166            provider_type,
167            request_token_url: None,
168            authorization_url: None,
169            access_token_url: None,
170            profile_url: None,
171            pkce: None,
172            consumer_key,
173            callback_url,
174            additional_scopes: None,
175            r#type,
176            oidc_well_known_url: None,
177            oidc_jwks_url: None,
178            oidc_jwks: None,
179            authorization_code_auth_method: None,
180        }
181    }
182}