authentik_rust/models/
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/// Source : Source Serializer
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Source {
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}
58
59impl Source {
60    /// Source Serializer
61    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>) -> Source {
62        Source {
63            pk,
64            name,
65            slug,
66            enabled: None,
67            authentication_flow: None,
68            enrollment_flow: None,
69            component,
70            verbose_name,
71            verbose_name_plural,
72            meta_model_name,
73            policy_engine_mode: None,
74            user_matching_mode: None,
75            managed,
76            user_path_template: None,
77            icon,
78        }
79    }
80}
81