pub struct LdapServerBuilder { /* private fields */ }
Expand description
LDAP server builder
Implementations§
Source§impl LdapServerBuilder
impl LdapServerBuilder
Sourcepub fn empty(
base_dn: impl Into<String>,
root_dn: impl Into<String>,
root_pw: impl Into<String>,
) -> Self
pub fn empty( base_dn: impl Into<String>, root_dn: impl Into<String>, root_pw: impl Into<String>, ) -> Self
Init empty builder
Sourcepub fn ssl_certificates(self, certificate: String, key: String) -> Self
pub fn ssl_certificates(self, certificate: String, key: String) -> Self
Use existing ssl certificate and key PEM
Sourcepub fn add_system_file<P: AsRef<Path>>(self, dbnum: u8, file: P) -> Self
pub fn add_system_file<P: AsRef<Path>>(self, dbnum: u8, file: P) -> Self
Add system LDIF from schema dir installed by slapd (usually in /etc/ldap/schema directory)
§Examples
use ldap_test_server::LdapServerBuilder;
let server = LdapServerBuilder::new("dc=planetexpress,dc=com")
.add_system_file(0, "collective.ldif")
.run().await;
Sourcepub fn add(self, dbnum: u8, content: &str) -> Self
pub fn add(self, dbnum: u8, content: &str) -> Self
Add LDIF file with text content
§Examples
use ldap_test_server::LdapServerBuilder;
let server = LdapServerBuilder::new("dc=planetexpress,dc=com")
.add(0, "dn: cn=user,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: user
olcAttributeTypes: ( 1.2.840.113556.4.221
NAME 'sAMAccountName'
SYNTAX '1.3.6.1.4.1.1466.115.121.1.15'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SINGLE-VALUE )
olcObjectClasses: ( 1.2.840.113556.1.5.9
NAME 'user'
SUP top
AUXILIARY
MAY ( sAMAccountName ))")
.run().await;
Sourcepub fn add_template(self, dbnum: u8, content: &str) -> Self
pub fn add_template(self, dbnum: u8, content: &str) -> Self
Add LDIF file with text content as template
§Examples
use ldap_test_server::{LdapServerConn, LdapServerBuilder};
let server: LdapServerConn = LdapServerBuilder::empty("dc=planetexpress,dc=com", "cn=admin,dc=planetexpress,dc=com", "secret")
.add_template(0, include_str!("init.ldif"))
.run().await;
Sourcepub fn add_template_file<P: AsRef<Path>>(self, dbnum: u8, file: P) -> Self
pub fn add_template_file<P: AsRef<Path>>(self, dbnum: u8, file: P) -> Self
Add LDIF file as template
Sourcepub async fn run(self) -> LdapServerConn
pub async fn run(self) -> LdapServerConn
Create database and run LDAP server
§Examples
use ldap_test_server::{LdapServerConn, LdapServerBuilder};
let server: LdapServerConn = LdapServerBuilder::new("dc=planetexpress,dc=com")
.run().await;
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LdapServerBuilder
impl RefUnwindSafe for LdapServerBuilder
impl Send for LdapServerBuilder
impl Sync for LdapServerBuilder
impl Unpin for LdapServerBuilder
impl UnwindSafe for LdapServerBuilder
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more