pub struct BootstrapManager { /* private fields */ }Expand description
Manages the first-run bootstrap process.
Implementations§
Source§impl BootstrapManager
impl BootstrapManager
Sourcepub fn check_and_generate(&mut self, user_store: &UserStore) -> Option<String>
pub fn check_and_generate(&mut self, user_store: &UserStore) -> Option<String>
Check if setup is required and generate bootstrap token if needed.
Returns the bootstrap token if one was generated.
Sourcepub fn complete_setup(
&mut self,
user_store: &UserStore,
token: &str,
username: &str,
password: &str,
email: Option<String>,
) -> Result<User, AuthError>
pub fn complete_setup( &mut self, user_store: &UserStore, token: &str, username: &str, password: &str, email: Option<String>, ) -> Result<User, AuthError>
Complete setup with the bootstrap token.
Creates the initial admin user and invalidates the bootstrap token.
§Errors
Returns error if token is invalid or user creation fails.
Sourcepub fn status(
&self,
user_store: &UserStore,
base_url: Option<&str>,
) -> SetupStatus
pub fn status( &self, user_store: &UserStore, base_url: Option<&str>, ) -> SetupStatus
Get setup status.
Sourcepub fn is_required(user_store: &UserStore) -> bool
pub fn is_required(user_store: &UserStore) -> bool
Check if bootstrap is required (no users exist).
Sourcepub fn token_time_remaining(&self) -> Option<Duration>
pub fn token_time_remaining(&self) -> Option<Duration>
Get time remaining on bootstrap token (if any).
Sourcepub fn invalidate_token(&mut self)
pub fn invalidate_token(&mut self)
Invalidate the current bootstrap token.
Sourcepub fn print_bootstrap_info(&self, base_url: &str)
pub fn print_bootstrap_info(&self, base_url: &str)
Print bootstrap information to console.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BootstrapManager
impl RefUnwindSafe for BootstrapManager
impl Send for BootstrapManager
impl Sync for BootstrapManager
impl Unpin for BootstrapManager
impl UnwindSafe for BootstrapManager
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