pub struct Basileus {
pub config: Config,
/* private fields */
}Expand description
Entry point for the library.
Fields§
§config: ConfigConfigurations.
Implementations§
Source§impl Basileus
impl Basileus
Sourcepub async fn exist_pass(&self, user: &str) -> Result<bool, Error>
pub async fn exist_pass(&self, user: &str) -> Result<bool, Error>
Whether a user has defined a password for authorization.
Sourcepub async fn update_pass(
&self,
user: &str,
pass: &str,
) -> Result<(), UpdatePassError>
pub async fn update_pass( &self, user: &str, pass: &str, ) -> Result<(), UpdatePassError>
Update password for specified user.
Sourcepub async fn verify_pass(
&self,
user: &str,
pass: &str,
) -> Result<bool, VerifyPassError>
pub async fn verify_pass( &self, user: &str, pass: &str, ) -> Result<bool, VerifyPassError>
Verify given password for user.
Sourcepub async fn delete_pass(&self, user: &str) -> Result<(), DeletePassError>
pub async fn delete_pass(&self, user: &str) -> Result<(), DeletePassError>
Delete a user’s password.
Source§impl Basileus
impl Basileus
Sourcepub async fn get_perm(&self, user: &str) -> Result<Perm, GetPermError>
pub async fn get_perm(&self, user: &str) -> Result<Perm, GetPermError>
Get permissions the user holds, i.e. group names.
Sourcepub async fn check_perm(
&self,
user: &str,
req: &Perm,
) -> Result<bool, CheckPermError>
pub async fn check_perm( &self, user: &str, req: &Perm, ) -> Result<bool, CheckPermError>
Check if the user has specified permission.
Sourcepub async fn set_perm(
&self,
user: &str,
perm: &Perm,
) -> Result<(), SetPermError>
pub async fn set_perm( &self, user: &str, perm: &Perm, ) -> Result<(), SetPermError>
Sets a user’s permission.
Sourcepub async fn give_perm(
&self,
user: &str,
perm: &Perm,
) -> Result<(), GivePermError>
pub async fn give_perm( &self, user: &str, perm: &Perm, ) -> Result<(), GivePermError>
Gives new permissions to specified user.
Sourcepub async fn revoke_perm(
&self,
user: &str,
perm: &Perm,
) -> Result<(), RevokePermError>
pub async fn revoke_perm( &self, user: &str, perm: &Perm, ) -> Result<(), RevokePermError>
Revoke a user’s certain permissions. This does not result in an error if the permission does not currently exist.
Source§impl Basileus
impl Basileus
Sourcepub async fn pkce_auth_req(
&self,
user: &str,
pass: &str,
code_challenge: CodeChallenge,
) -> Result<String, PkceAuthError>
pub async fn pkce_auth_req( &self, user: &str, pass: &str, code_challenge: CodeChallenge, ) -> Result<String, PkceAuthError>
Handle a PKCE authorization request.
If the authorization is successful, returns a base64URL-encoded authorization code.
Sourcepub fn pkce_token_req(
&self,
code: &str,
code_verifier: &str,
) -> Result<String, PkceTokenError>
pub fn pkce_token_req( &self, code: &str, code_verifier: &str, ) -> Result<String, PkceTokenError>
Handle a PKCE access token request.
A successful request requires a valid previously issued authorization code (through Self::pkce_auth_req) and a matching code verifier.
Returns the token if successful.
Source§impl Basileus
impl Basileus
Sourcepub fn issue_token(&self, user: &str) -> String
pub fn issue_token(&self, user: &str) -> String
Issue a new token to the specified user.
Sourcepub fn invalidate_token(&self, token: &str)
pub fn invalidate_token(&self, token: &str)
Invalidate a token.
Sourcepub fn invalidate_user_token(&self, user: &str)
pub fn invalidate_user_token(&self, user: &str)
Invalidate all tokens related to user.
Sourcepub fn expire_token(&self, duration: Duration)
pub fn expire_token(&self, duration: Duration)
Make all tokens older than duration expire.
Sourcepub fn verify_token(&self, token: &str) -> Option<String>
pub fn verify_token(&self, token: &str) -> Option<String>
Verify token, return the user it belongs to if successful.
Source§impl Basileus
impl Basileus
Sourcepub async fn exist_user(&self, user: &str) -> Result<bool, Error>
pub async fn exist_user(&self, user: &str) -> Result<bool, Error>
Check whether a user currently exists.
Sourcepub async fn create_user(&self, user: &str) -> Result<(), CreateUserError>
pub async fn create_user(&self, user: &str) -> Result<(), CreateUserError>
Create a new user.
Sourcepub async fn delete_user(&self, user: &str) -> Result<(), DeleteUserError>
pub async fn delete_user(&self, user: &str) -> Result<(), DeleteUserError>
Delete a user.
Auto Trait Implementations§
impl !Freeze for Basileus
impl !RefUnwindSafe for Basileus
impl Send for Basileus
impl Sync for Basileus
impl Unpin for Basileus
impl !UnwindSafe for Basileus
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
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 more