pub struct LdapProviderConfig {
pub url: String,
pub bind_dn_template: String,
pub starttls: bool,
pub connection_timeout: Duration,
pub group_search: Option<LdapGroupSearch>,
}ldap only.Expand description
Production LDAP provider wrapping the ldap3 crate.
§TLS requirements
LDAP simple bind transmits passwords in the protocol data unit. Always use TLS to protect credentials on the wire:
- Preferred:
ldaps://URLs (TLS from the first byte, port 636). - Alternative:
ldap://with.with_starttls()(upgrades to TLS after connect, port 389).
Certificate validation uses the system CA trust store (via rustls). For
private CAs (common in enterprise AD deployments), install the CA
certificate in the OS trust store or use the SSL_CERT_FILE /
SSL_CERT_DIR environment variables.
Plain ldap:// without STARTTLS sends credentials in cleartext and must
not be used outside localhost development.
Fields§
§url: StringLDAP server URL (e.g. "ldap://ad.example.com:389" or
"ldaps://ad.example.com:636").
bind_dn_template: StringTemplate for constructing the bind DN from the user identifier.
{user} is replaced with the login identifier.
Active Directory: "{user}@corp.example.com" (UPN) or "CORP\\{user}"
OpenLDAP: "uid={user},ou=people,dc=example,dc=com"
starttls: boolUse STARTTLS on plain LDAP connections. Ignored for ldaps:// URLs.
connection_timeout: DurationConnection timeout. Default: 5 seconds.
group_search: Option<LdapGroupSearch>Optional group membership search after successful bind.
Implementations§
Source§impl LdapProviderConfig
impl LdapProviderConfig
Sourcepub fn new(
url: impl Into<String>,
bind_dn_template: impl Into<String>,
) -> LdapProviderConfig
pub fn new( url: impl Into<String>, bind_dn_template: impl Into<String>, ) -> LdapProviderConfig
Create a new LDAP provider configuration.
§Arguments
url: LDAP server URL (ldap://orldaps://)bind_dn_template: template with{user}placeholder
Sourcepub fn with_starttls(self) -> LdapProviderConfig
pub fn with_starttls(self) -> LdapProviderConfig
Enable STARTTLS on plain LDAP connections.
Sourcepub fn with_timeout(self, timeout: Duration) -> LdapProviderConfig
pub fn with_timeout(self, timeout: Duration) -> LdapProviderConfig
Set the connection timeout.
Sourcepub fn with_group_search(self, search: LdapGroupSearch) -> LdapProviderConfig
pub fn with_group_search(self, search: LdapGroupSearch) -> LdapProviderConfig
Configure group membership search after successful bind.
Trait Implementations§
Source§impl HealthCheck for LdapProviderConfig
impl HealthCheck for LdapProviderConfig
Source§impl LdapProvider for LdapProviderConfig
impl LdapProvider for LdapProviderConfig
Auto Trait Implementations§
impl Freeze for LdapProviderConfig
impl RefUnwindSafe for LdapProviderConfig
impl Send for LdapProviderConfig
impl Sync for LdapProviderConfig
impl Unpin for LdapProviderConfig
impl UnsafeUnpin for LdapProviderConfig
impl UnwindSafe for LdapProviderConfig
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.