pub struct LdapAdClient { /* private fields */ }Expand description
Active Directory LDAP client wrapper.
Provides AD-specific operations like user lookup by sAMAccountName, group membership extraction, and bind-based authentication.
Implementations§
Source§impl LdapAdClient
impl LdapAdClient
Sourcepub fn new(domain: &str, base_dn: &str) -> Self
pub fn new(domain: &str, base_dn: &str) -> Self
Create a new AD client for the given domain and base DN.
Sourcepub fn client(&self) -> &LdapClient
pub fn client(&self) -> &LdapClient
Get a reference to the underlying LDAP client.
Sourcepub fn client_mut(&mut self) -> &mut LdapClient
pub fn client_mut(&mut self) -> &mut LdapClient
Get a mutable reference to the underlying LDAP client.
Sourcepub fn user_filter(username: &str) -> LdapFilter
pub fn user_filter(username: &str) -> LdapFilter
Build a user search filter for sAMAccountName.
Sourcepub fn search_user(&mut self, username: &str) -> Vec<u8>
pub fn search_user(&mut self, username: &str) -> Vec<u8>
Encode a search request for a specific user by sAMAccountName.
Sourcepub fn authenticate_user(&mut self, username: &str, password: &str) -> Vec<u8>
pub fn authenticate_user(&mut self, username: &str, password: &str) -> Vec<u8>
Encode a bind request for user authentication.
Uses the UPN format: username@domain.
Sourcepub fn groups_filter(user_dn: &str) -> LdapFilter
pub fn groups_filter(user_dn: &str) -> LdapFilter
Build a filter to find groups for a user DN.
Sourcepub fn get_groups(&mut self, user_dn: &str) -> Vec<u8>
pub fn get_groups(&mut self, user_dn: &str) -> Vec<u8>
Encode a search request for groups containing the given user DN.
Sourcepub fn extract_groups(entry: &SearchEntry) -> Vec<String>
pub fn extract_groups(entry: &SearchEntry) -> Vec<String>
Extract group names from the memberOf attribute of a search entry.