pub struct AuthState {
pub config: AuthConfig,
pub jwt: JwtManager,
pub users: UserStore,
pub bootstrap: RwLock<BootstrapManager>,
}Expand description
Shared authentication state.
Fields§
§config: AuthConfigAuth configuration.
jwt: JwtManagerJWT manager.
users: UserStoreUser store.
bootstrap: RwLock<BootstrapManager>Bootstrap manager.
Implementations§
Source§impl AuthState
impl AuthState
Sourcepub fn new(config: AuthConfig, jwt: JwtManager, users: UserStore) -> Self
pub fn new(config: AuthConfig, jwt: JwtManager, users: UserStore) -> Self
Create a new auth state.
Sourcepub fn initialize(
config: AuthConfig,
data_dir: &Path,
) -> Result<Self, AuthError>
pub fn initialize( config: AuthConfig, data_dir: &Path, ) -> Result<Self, AuthError>
Initialize auth state, auto-generating JWT secret if needed.
§Errors
Returns error if initialization fails.
Sourcepub fn requires_auth(&self, method: &str) -> bool
pub fn requires_auth(&self, method: &str) -> bool
Check if auth is required for a method.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AuthState
impl !RefUnwindSafe for AuthState
impl Send for AuthState
impl Sync for AuthState
impl Unpin for AuthState
impl !UnwindSafe for AuthState
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