Skip to main content

UnitLdapConfig

Struct UnitLdapConfig 

Source
pub struct UnitLdapConfig { /* private fields */ }
Expand description

LDAP server configuration used to scope credential pairs registered with [UnitTest::add_ldap_data].

A registered credential pair is considered a match when its associated UnitLdapConfig equals the LDAP connection parameters used by the policy.

Construct a value using the builder methods, starting from Default::default:

let config = UnitLdapConfig::default()
    .server_url("ldap://ldap.example.com:389")
    .server_user_dn("cn=admin,dc=example,dc=com")
    .server_user_password("secret")
    .search_base("ou=users,dc=example,dc=com")
    .search_filter("(uid={0})")
    .search_in_subtree();

Implementations§

Source§

impl UnitLdapConfig

Source

pub fn server_url(self, url: impl Into<String>) -> Self

Sets the LDAP server URL (e.g. ldap://ldap.example.com:389).

Source

pub fn server_user_dn(self, dn: impl Into<String>) -> Self

Sets the distinguished name used to bind to the LDAP server (e.g. cn=admin,dc=example,dc=com).

Source

pub fn server_user_password(self, pass: impl Into<String>) -> Self

Sets the password used together with server_user_dn to bind to the LDAP server.

Source

pub fn search_base(self, base: impl Into<String>) -> Self

Sets the base DN from which the user search is performed (e.g. ou=users,dc=example,dc=com).

Source

pub fn search_filter(self, filter: impl Into<String>) -> Self

Sets the LDAP search filter used to locate the authenticating user (e.g. (uid={0})).

Source

pub fn search_in_subtree(self) -> Self

Enables recursive subtree searching instead of a single-level search.

Trait Implementations§

Source§

impl Default for UnitLdapConfig

Source§

fn default() -> UnitLdapConfig

Returns the “default value” for a type. Read more
Source§

impl Hash for UnitLdapConfig

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for UnitLdapConfig

Source§

fn eq(&self, other: &UnitLdapConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for UnitLdapConfig

Source§

impl StructuralPartialEq for UnitLdapConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<C, T> Extract<T> for C
where T: FromContext<C>,

Source§

type Error = <T as FromContext<C>>::Error

Source§

fn extract(&self) -> Result<T, <C as Extract<T>>::Error>

Source§

fn extract_always(&self) -> T
where Self: Extract<T, Error = Infallible>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.