authentik_rust/models/
source_request.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/// SourceRequest : Source Serializer
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct SourceRequest {
16    /// Source's display Name.
17    #[serde(rename = "name")]
18    pub name: String,
19    /// Internal source name, used in URLs.
20    #[serde(rename = "slug")]
21    pub slug: String,
22    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
23    pub enabled: Option<bool>,
24    /// Flow to use when authenticating existing users.
25    #[serde(rename = "authentication_flow", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub authentication_flow: Option<Option<uuid::Uuid>>,
27    /// Flow to use when enrolling new users.
28    #[serde(rename = "enrollment_flow", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub enrollment_flow: Option<Option<uuid::Uuid>>,
30    #[serde(rename = "policy_engine_mode", skip_serializing_if = "Option::is_none")]
31    pub policy_engine_mode: Option<models::PolicyEngineMode>,
32    /// 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.
33    #[serde(rename = "user_matching_mode", skip_serializing_if = "Option::is_none")]
34    pub user_matching_mode: Option<models::UserMatchingModeEnum>,
35    #[serde(rename = "user_path_template", skip_serializing_if = "Option::is_none")]
36    pub user_path_template: Option<String>,
37}
38
39impl SourceRequest {
40    /// Source Serializer
41    pub fn new(name: String, slug: String) -> SourceRequest {
42        SourceRequest {
43            name,
44            slug,
45            enabled: None,
46            authentication_flow: None,
47            enrollment_flow: None,
48            policy_engine_mode: None,
49            user_matching_mode: None,
50            user_path_template: None,
51        }
52    }
53}
54