authentik_rust/models/
password_policy.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/// PasswordPolicy : Password Policy Serializer
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct PasswordPolicy {
16    #[serde(rename = "pk")]
17    pub pk: uuid::Uuid,
18    #[serde(rename = "name")]
19    pub name: String,
20    /// When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.
21    #[serde(rename = "execution_logging", skip_serializing_if = "Option::is_none")]
22    pub execution_logging: Option<bool>,
23    /// Get object component so that we know how to edit the object
24    #[serde(rename = "component")]
25    pub component: String,
26    /// Return object's verbose_name
27    #[serde(rename = "verbose_name")]
28    pub verbose_name: String,
29    /// Return object's plural verbose_name
30    #[serde(rename = "verbose_name_plural")]
31    pub verbose_name_plural: String,
32    /// Return internal model name
33    #[serde(rename = "meta_model_name")]
34    pub meta_model_name: String,
35    /// Return objects policy is bound to
36    #[serde(rename = "bound_to")]
37    pub bound_to: i32,
38    /// Field key to check, field keys defined in Prompt stages are available.
39    #[serde(rename = "password_field", skip_serializing_if = "Option::is_none")]
40    pub password_field: Option<String>,
41    #[serde(rename = "amount_digits", skip_serializing_if = "Option::is_none")]
42    pub amount_digits: Option<i32>,
43    #[serde(rename = "amount_uppercase", skip_serializing_if = "Option::is_none")]
44    pub amount_uppercase: Option<i32>,
45    #[serde(rename = "amount_lowercase", skip_serializing_if = "Option::is_none")]
46    pub amount_lowercase: Option<i32>,
47    #[serde(rename = "amount_symbols", skip_serializing_if = "Option::is_none")]
48    pub amount_symbols: Option<i32>,
49    #[serde(rename = "length_min", skip_serializing_if = "Option::is_none")]
50    pub length_min: Option<i32>,
51    #[serde(rename = "symbol_charset", skip_serializing_if = "Option::is_none")]
52    pub symbol_charset: Option<String>,
53    #[serde(rename = "error_message", skip_serializing_if = "Option::is_none")]
54    pub error_message: Option<String>,
55    #[serde(rename = "check_static_rules", skip_serializing_if = "Option::is_none")]
56    pub check_static_rules: Option<bool>,
57    #[serde(rename = "check_have_i_been_pwned", skip_serializing_if = "Option::is_none")]
58    pub check_have_i_been_pwned: Option<bool>,
59    #[serde(rename = "check_zxcvbn", skip_serializing_if = "Option::is_none")]
60    pub check_zxcvbn: Option<bool>,
61    /// How many times the password hash is allowed to be on haveibeenpwned
62    #[serde(rename = "hibp_allowed_count", skip_serializing_if = "Option::is_none")]
63    pub hibp_allowed_count: Option<i32>,
64    /// If the zxcvbn score is equal or less than this value, the policy will fail.
65    #[serde(rename = "zxcvbn_score_threshold", skip_serializing_if = "Option::is_none")]
66    pub zxcvbn_score_threshold: Option<i32>,
67}
68
69impl PasswordPolicy {
70    /// Password Policy Serializer
71    pub fn new(pk: uuid::Uuid, name: String, component: String, verbose_name: String, verbose_name_plural: String, meta_model_name: String, bound_to: i32) -> PasswordPolicy {
72        PasswordPolicy {
73            pk,
74            name,
75            execution_logging: None,
76            component,
77            verbose_name,
78            verbose_name_plural,
79            meta_model_name,
80            bound_to,
81            password_field: None,
82            amount_digits: None,
83            amount_uppercase: None,
84            amount_lowercase: None,
85            amount_symbols: None,
86            length_min: None,
87            symbol_charset: None,
88            error_message: None,
89            check_static_rules: None,
90            check_have_i_been_pwned: None,
91            check_zxcvbn: None,
92            hibp_allowed_count: None,
93            zxcvbn_score_threshold: None,
94        }
95    }
96}
97