Skip to main content

authentik_client/models/
password_policy.rs

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