authentik_rust/models/
o_auth_source.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2024.2.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13/// OAuthSource : OAuth Source Serializer
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct OAuthSource {
16    #[serde(rename = "pk")]
17    pub pk: uuid::Uuid,
18    /// Source's display Name.
19    #[serde(rename = "name")]
20    pub name: String,
21    /// Internal source name, used in URLs.
22    #[serde(rename = "slug")]
23    pub slug: String,
24    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
25    pub enabled: Option<bool>,
26    /// Flow to use when authenticating existing users.
27    #[serde(rename = "authentication_flow", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub authentication_flow: Option<Option<uuid::Uuid>>,
29    /// Flow to use when enrolling new users.
30    #[serde(rename = "enrollment_flow", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub enrollment_flow: Option<Option<uuid::Uuid>>,
32    /// Get object component so that we know how to edit the object
33    #[serde(rename = "component")]
34    pub component: String,
35    /// Return object's verbose_name
36    #[serde(rename = "verbose_name")]
37    pub verbose_name: String,
38    /// Return object's plural verbose_name
39    #[serde(rename = "verbose_name_plural")]
40    pub verbose_name_plural: String,
41    /// Return internal model name
42    #[serde(rename = "meta_model_name")]
43    pub meta_model_name: String,
44    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
45    pub policy_engine_mode: Option<models::PolicyEngineMode>,
46    /// How the source determines if an existing user should be authenticated or a new user enrolled.  * `identifier` - Use the source-specific identifier * `email_link` - Link to a user with identical email address. Can have security implications when a source doesn't validate email addresses. * `email_deny` - Use the user's email address, but deny enrollment when the email address already exists. * `username_link` - Link to a user with identical username. Can have security implications when a username is used with another source. * `username_deny` - Use the user's username, but deny enrollment when the username already exists.
47    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
48    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
49    /// 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.
50    #[serde(rename = "managed", deserialize_with = "Option::deserialize")]
51    pub managed: Option<String>,
52    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
53    pub user_path_template: Option<String>,
54    /// Get the URL to the Icon. If the name is /static or starts with http it is returned as-is
55    #[serde(rename = "icon", deserialize_with = "Option::deserialize")]
56    pub icon: Option<String>,
57    #[serde(rename = "provider_type")]
58    pub provider_type: models::ProviderTypeEnum,
59    /// URL used to request the initial token. This URL is only required for OAuth 1.
60    #[serde(rename = "request_token_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
61    pub request_token_url: Option<Option<String>>,
62    /// URL the user is redirect to to conest the flow.
63    #[serde(rename = "authorization_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
64    pub authorization_url: Option<Option<String>>,
65    /// URL used by authentik to retrieve tokens.
66    #[serde(rename = "access_token_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
67    pub access_token_url: Option<Option<String>>,
68    /// URL used by authentik to get user information.
69    #[serde(rename = "profile_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
70    pub profile_url: Option<Option<String>>,
71    #[serde(rename = "consumer_key")]
72    pub consumer_key: String,
73    /// Get OAuth Callback URL
74    #[serde(rename = "callback_url")]
75    pub callback_url: String,
76    #[serde(rename = "additional_scopes", skip_serializing_if = "Option::is_none")]
77    pub additional_scopes: Option<String>,
78    #[serde(rename = "type")]
79    pub r#type: Box<models::SourceType>,
80    #[serde(rename = "oidc_well_known_url", skip_serializing_if = "Option::is_none")]
81    pub oidc_well_known_url: Option<String>,
82    #[serde(rename = "oidc_jwks_url", skip_serializing_if = "Option::is_none")]
83    pub oidc_jwks_url: Option<String>,
84    #[serde(rename = "oidc_jwks", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
85    pub oidc_jwks: Option<Option<serde_json::Value>>,
86}
87
88impl OAuthSource {
89    /// OAuth Source Serializer
90    pub fn new(pk: uuid::Uuid, name: String, slug: String, component: String, verbose_name: String, verbose_name_plural: String, meta_model_name: String, managed: Option<String>, icon: Option<String>, provider_type: models::ProviderTypeEnum, consumer_key: String, callback_url: String, r#type: models::SourceType) -> OAuthSource {
91        OAuthSource {
92            pk,
93            name,
94            slug,
95            enabled: None,
96            authentication_flow: None,
97            enrollment_flow: None,
98            component,
99            verbose_name,
100            verbose_name_plural,
101            meta_model_name,
102            policy_engine_mode: None,
103            user_matching_mode: None,
104            managed,
105            user_path_template: None,
106            icon,
107            provider_type,
108            request_token_url: None,
109            authorization_url: None,
110            access_token_url: None,
111            profile_url: None,
112            consumer_key,
113            callback_url,
114            additional_scopes: None,
115            r#type: Box::new(r#type),
116            oidc_well_known_url: None,
117            oidc_jwks_url: None,
118            oidc_jwks: None,
119        }
120    }
121}
122