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
impl UnitLdapConfig
Sourcepub fn server_url(self, url: impl Into<String>) -> Self
pub fn server_url(self, url: impl Into<String>) -> Self
Sets the LDAP server URL (e.g. ldap://ldap.example.com:389).
Sourcepub fn server_user_dn(self, dn: impl Into<String>) -> Self
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).
Sourcepub fn server_user_password(self, pass: impl Into<String>) -> Self
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.
Sourcepub fn search_base(self, base: impl Into<String>) -> Self
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).
Sourcepub fn search_filter(self, filter: impl Into<String>) -> Self
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})).
Sourcepub fn search_in_subtree(self) -> Self
pub fn search_in_subtree(self) -> Self
Enables recursive subtree searching instead of a single-level search.