pub struct PolicyBuilder { /* private fields */ }Expand description
Utility to create a policy
let kadm = kadmin::KAdmin::builder().with_ccache(None, None).unwrap();
let polname = String::from("mynewpol");
let password_max_life = Some(Duration::from_secs(365 * 24 * 60 * 60));
let policy = Policy::builder(&polname)
.password_max_life(password_max_life)
.create(&kadm)
.unwrap();
assert_eq!(policy.password_max_life(), password_max_life);Implementations§
Source§impl PolicyBuilder
impl PolicyBuilder
Sourcepub fn password_min_life(self, password_min_life: Option<Duration>) -> Self
pub fn password_min_life(self, password_min_life: Option<Duration>) -> Self
Set the minimum lifetime of a password
Pass None to clear it. Defaults to not set
Sourcepub fn password_max_life(self, password_max_life: Option<Duration>) -> Self
pub fn password_max_life(self, password_max_life: Option<Duration>) -> Self
Set the maximum lifetime of a password
Pass None to clear it. Defaults to not set
Sourcepub fn password_min_length(self, password_min_length: c_long) -> Self
pub fn password_min_length(self, password_min_length: c_long) -> Self
Set the minimum length of a password
Defaults to not set
Sourcepub fn password_min_classes(self, password_min_classes: c_long) -> Self
pub fn password_min_classes(self, password_min_classes: c_long) -> Self
Set the minimum number of character classes required in a password. The five character classes are lower case, upper case, numbers, punctuation, and whitespace/unprintable characters
Defaults to not set
Sourcepub fn password_history_num(self, password_history_num: c_long) -> Self
pub fn password_history_num(self, password_history_num: c_long) -> Self
Set the number of past keys kept for a principal. May be ignored if used with other database modules such as the MIT krb5 LDAP KDC database module
Defaults to not set
Sourcepub fn password_max_fail(self, password_max_fail: krb5_kvno) -> Self
pub fn password_max_fail(self, password_max_fail: krb5_kvno) -> Self
Set the number of authentication failures before the principal is locked. Authentication failures are only tracked for principals which require preauthentication. The counter of failed attempts resets to 0 after a successful attempt to authenticate. A value of 0 disables lock‐out
Defaults to not set
Sourcepub fn password_failcount_interval(
self,
password_failcount_interval: Option<Duration>,
) -> Self
pub fn password_failcount_interval( self, password_failcount_interval: Option<Duration>, ) -> Self
Set the allowable time between authentication failures. If an authentication failure happens after this duration has elapsed since the previous failure, the number of authentication failures is reset to 1.
Setting this to None means forever. Defaults to not set
Sourcepub fn password_lockout_duration(
self,
password_lockout_duration: Option<Duration>,
) -> Self
pub fn password_lockout_duration( self, password_lockout_duration: Option<Duration>, ) -> Self
Set the duration for which the principal is locked from authenticating if too many authentication failures occur without the specified failure count interval elapsing.
Setting this to None means the principal remains locked out until it is
administratively unlocked. Defaults to not set
Sourcepub fn attributes(self, attributes: krb5_flags) -> Self
pub fn attributes(self, attributes: krb5_flags) -> Self
Set policy attributes
Sourcepub fn max_renewable_life(self, max_renewable_life: Option<Duration>) -> Self
pub fn max_renewable_life(self, max_renewable_life: Option<Duration>) -> Self
Set the maximum renewable ticket life
Sourcepub fn allowed_keysalts(self, allowed_keysalts: Option<KeySalts>) -> Self
pub fn allowed_keysalts(self, allowed_keysalts: Option<KeySalts>) -> Self
Set the allowed keysalts
Pass None to clear it. Defaults to not set
Sourcepub fn new(name: &str) -> Self
pub fn new(name: &str) -> Self
Construct a new PolicyBuilder for a policy with name
Trait Implementations§
Source§impl Clone for PolicyBuilder
impl Clone for PolicyBuilder
Source§fn clone(&self) -> PolicyBuilder
fn clone(&self) -> PolicyBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more