Skip to main content

authentik_client/models/
o_auth_source_request.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2025.12.4
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// OAuthSourceRequest : OAuth Source Serializer
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OAuthSourceRequest {
17    /// Source's display Name.
18    #[serde(rename = "name")]
19    pub name: String,
20    /// Internal source name, used in URLs.
21    #[serde(rename = "slug")]
22    pub slug: String,
23    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
24    pub enabled: Option<bool>,
25    /// When enabled, this source will be displayed as a prominent button on the login page, instead of a small icon.
26    #[serde(rename = "promoted", skip_serializing_if = "Option::is_none")]
27    pub promoted: Option<bool>,
28    /// Flow to use when authenticating existing users.
29    #[serde(
30        rename = "authentication_flow",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub authentication_flow: Option<Option<uuid::Uuid>>,
36    /// Flow to use when enrolling new users.
37    #[serde(
38        rename = "enrollment_flow",
39        default,
40        with = "::serde_with::rust::double_option",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub enrollment_flow: Option<Option<uuid::Uuid>>,
44    #[serde(rename = "user_property_mappings", skip_serializing_if = "Option::is_none")]
45    pub user_property_mappings: Option<Vec<uuid::Uuid>>,
46    #[serde(rename = "group_property_mappings", skip_serializing_if = "Option::is_none")]
47    pub group_property_mappings: Option<Vec<uuid::Uuid>>,
48    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
49    pub policy_engine_mode: Option<models::PolicyEngineMode>,
50    /// How the source determines if an existing user should be authenticated or a new user enrolled.
51    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
52    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
53    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
54    pub user_path_template: Option<String>,
55    #[serde(rename = "icon", skip_serializing_if = "Option::is_none")]
56    pub icon: Option<String>,
57    /// How the source determines if an existing group should be used or a new group created.
58    #[serde(rename = "group_matching_mode", skip_serializing_if = "Option::is_none")]
59    pub group_matching_mode: Option<models::GroupMatchingModeEnum>,
60    #[serde(rename = "provider_type")]
61    pub provider_type: models::ProviderTypeEnum,
62    /// URL used to request the initial token. This URL is only required for OAuth 1.
63    #[serde(
64        rename = "request_token_url",
65        default,
66        with = "::serde_with::rust::double_option",
67        skip_serializing_if = "Option::is_none"
68    )]
69    pub request_token_url: Option<Option<String>>,
70    /// URL the user is redirect to to conest the flow.
71    #[serde(
72        rename = "authorization_url",
73        default,
74        with = "::serde_with::rust::double_option",
75        skip_serializing_if = "Option::is_none"
76    )]
77    pub authorization_url: Option<Option<String>>,
78    /// URL used by authentik to retrieve tokens.
79    #[serde(
80        rename = "access_token_url",
81        default,
82        with = "::serde_with::rust::double_option",
83        skip_serializing_if = "Option::is_none"
84    )]
85    pub access_token_url: Option<Option<String>>,
86    /// URL used by authentik to get user information.
87    #[serde(
88        rename = "profile_url",
89        default,
90        with = "::serde_with::rust::double_option",
91        skip_serializing_if = "Option::is_none"
92    )]
93    pub profile_url: Option<Option<String>>,
94    #[serde(rename = "pkce", skip_serializing_if = "Option::is_none")]
95    pub pkce: Option<models::PkceMethodEnum>,
96    #[serde(rename = "consumer_key")]
97    pub consumer_key: String,
98    #[serde(rename = "consumer_secret")]
99    pub consumer_secret: String,
100    #[serde(rename = "additional_scopes", skip_serializing_if = "Option::is_none")]
101    pub additional_scopes: Option<String>,
102    #[serde(rename = "oidc_well_known_url", skip_serializing_if = "Option::is_none")]
103    pub oidc_well_known_url: Option<String>,
104    #[serde(rename = "oidc_jwks_url", skip_serializing_if = "Option::is_none")]
105    pub oidc_jwks_url: Option<String>,
106    #[serde(rename = "oidc_jwks", skip_serializing_if = "Option::is_none")]
107    pub oidc_jwks: Option<std::collections::HashMap<String, serde_json::Value>>,
108    /// How to perform authentication during an authorization_code token request flow
109    #[serde(rename = "authorization_code_auth_method", skip_serializing_if = "Option::is_none")]
110    pub authorization_code_auth_method: Option<models::AuthorizationCodeAuthMethodEnum>,
111}
112
113impl OAuthSourceRequest {
114    /// OAuth Source Serializer
115    pub fn new(
116        name: String,
117        slug: String,
118        provider_type: models::ProviderTypeEnum,
119        consumer_key: String,
120        consumer_secret: String,
121    ) -> OAuthSourceRequest {
122        OAuthSourceRequest {
123            name,
124            slug,
125            enabled: None,
126            promoted: None,
127            authentication_flow: None,
128            enrollment_flow: None,
129            user_property_mappings: None,
130            group_property_mappings: None,
131            policy_engine_mode: None,
132            user_matching_mode: None,
133            user_path_template: None,
134            icon: None,
135            group_matching_mode: None,
136            provider_type,
137            request_token_url: None,
138            authorization_url: None,
139            access_token_url: None,
140            profile_url: None,
141            pkce: None,
142            consumer_key,
143            consumer_secret,
144            additional_scopes: None,
145            oidc_well_known_url: None,
146            oidc_jwks_url: None,
147            oidc_jwks: None,
148            authorization_code_auth_method: None,
149        }
150    }
151}