authentik_rust/models/
ldap_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/// LdapSource : LDAP Source Serializer
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct LdapSource {
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 = "server_uri")]
58    pub server_uri: String,
59    /// Optionally verify the LDAP Server's Certificate against the CA Chain in this keypair.
60    #[serde(rename = "peer_certificate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
61    pub peer_certificate: Option<Option<uuid::Uuid>>,
62    /// Client certificate to authenticate against the LDAP Server's Certificate.
63    #[serde(rename = "client_certificate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
64    pub client_certificate: Option<Option<uuid::Uuid>>,
65    #[serde(rename = "bind_cn", skip_serializing_if = "Option::is_none")]
66    pub bind_cn: Option<String>,
67    #[serde(rename = "start_tls", skip_serializing_if = "Option::is_none")]
68    pub start_tls: Option<bool>,
69    #[serde(rename = "sni", skip_serializing_if = "Option::is_none")]
70    pub sni: Option<bool>,
71    #[serde(rename = "base_dn")]
72    pub base_dn: String,
73    /// Prepended to Base DN for User-queries.
74    #[serde(rename = "additional_user_dn", skip_serializing_if = "Option::is_none")]
75    pub additional_user_dn: Option<String>,
76    /// Prepended to Base DN for Group-queries.
77    #[serde(rename = "additional_group_dn", skip_serializing_if = "Option::is_none")]
78    pub additional_group_dn: Option<String>,
79    /// Consider Objects matching this filter to be Users.
80    #[serde(rename = "user_object_filter", skip_serializing_if = "Option::is_none")]
81    pub user_object_filter: Option<String>,
82    /// Consider Objects matching this filter to be Groups.
83    #[serde(rename = "group_object_filter", skip_serializing_if = "Option::is_none")]
84    pub group_object_filter: Option<String>,
85    /// Field which contains members of a group.
86    #[serde(rename = "group_membership_field", skip_serializing_if = "Option::is_none")]
87    pub group_membership_field: Option<String>,
88    /// Field which contains a unique Identifier.
89    #[serde(rename = "object_uniqueness_field", skip_serializing_if = "Option::is_none")]
90    pub object_uniqueness_field: Option<String>,
91    #[serde(rename = "sync_users", skip_serializing_if = "Option::is_none")]
92    pub sync_users: Option<bool>,
93    /// When a user changes their password, sync it back to LDAP. This can only be enabled on a single LDAP source.
94    #[serde(rename = "sync_users_password", skip_serializing_if = "Option::is_none")]
95    pub sync_users_password: Option<bool>,
96    #[serde(rename = "sync_groups", skip_serializing_if = "Option::is_none")]
97    pub sync_groups: Option<bool>,
98    #[serde(rename = "sync_parent_group", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
99    pub sync_parent_group: Option<Option<uuid::Uuid>>,
100    #[serde(rename = "property_mappings", skip_serializing_if = "Option::is_none")]
101    pub property_mappings: Option<Vec<uuid::Uuid>>,
102    /// Property mappings used for group creation/updating.
103    #[serde(rename = "property_mappings_group", skip_serializing_if = "Option::is_none")]
104    pub property_mappings_group: Option<Vec<uuid::Uuid>>,
105    /// Get cached source connectivity
106    #[serde(rename = "connectivity", deserialize_with = "Option::deserialize")]
107    pub connectivity: Option<std::collections::HashMap<String, std::collections::HashMap<String, String>>>,
108}
109
110impl LdapSource {
111    /// LDAP Source Serializer
112    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>, server_uri: String, base_dn: String, connectivity: Option<std::collections::HashMap<String, std::collections::HashMap<String, String>>>) -> LdapSource {
113        LdapSource {
114            pk,
115            name,
116            slug,
117            enabled: None,
118            authentication_flow: None,
119            enrollment_flow: None,
120            component,
121            verbose_name,
122            verbose_name_plural,
123            meta_model_name,
124            policy_engine_mode: None,
125            user_matching_mode: None,
126            managed,
127            user_path_template: None,
128            icon,
129            server_uri,
130            peer_certificate: None,
131            client_certificate: None,
132            bind_cn: None,
133            start_tls: None,
134            sni: None,
135            base_dn,
136            additional_user_dn: None,
137            additional_group_dn: None,
138            user_object_filter: None,
139            group_object_filter: None,
140            group_membership_field: None,
141            object_uniqueness_field: None,
142            sync_users: None,
143            sync_users_password: None,
144            sync_groups: None,
145            sync_parent_group: None,
146            property_mappings: None,
147            property_mappings_group: None,
148            connectivity,
149        }
150    }
151}
152