pub struct MemoryAuthService { /* private fields */ }Expand description
内存认证服务
Implementations§
Source§impl MemoryAuthService
impl MemoryAuthService
Sourcepub fn new(config: AuthConfig) -> Self
pub fn new(config: AuthConfig) -> Self
创建新的内存认证服务
Trait Implementations§
Source§impl AuthService for MemoryAuthService
impl AuthService for MemoryAuthService
Source§async fn login(&self, credentials: &Credentials) -> AuthResult<AuthToken>
async fn login(&self, credentials: &Credentials) -> AuthResult<AuthToken>
用户登录 Read more
Source§async fn refresh_token(&self, refresh_token: &str) -> AuthResult<AuthToken>
async fn refresh_token(&self, refresh_token: &str) -> AuthResult<AuthToken>
刷新 Token Read more
Source§async fn validate_token(&self, token: &str) -> AuthResult<TokenValidation>
async fn validate_token(&self, token: &str) -> AuthResult<TokenValidation>
验证 Token Read more
Source§async fn create_user(&self, request: &CreateUserRequest) -> AuthResult<UserInfo>
async fn create_user(&self, request: &CreateUserRequest) -> AuthResult<UserInfo>
创建用户 Read more
Source§async fn update_user(
&self,
user_id: &str,
request: &UpdateUserRequest,
) -> AuthResult<UserInfo>
async fn update_user( &self, user_id: &str, request: &UpdateUserRequest, ) -> AuthResult<UserInfo>
更新用户信息 Read more
Source§async fn delete_user(&self, user_id: &str) -> AuthResult<()>
async fn delete_user(&self, user_id: &str) -> AuthResult<()>
删除用户 Read more
Source§async fn change_password(
&self,
user_id: &str,
request: &ChangePasswordRequest,
) -> AuthResult<()>
async fn change_password( &self, user_id: &str, request: &ChangePasswordRequest, ) -> AuthResult<()>
修改密码 Read more
Source§async fn reset_password(&self, identifier: &str) -> AuthResult<()>
async fn reset_password(&self, identifier: &str) -> AuthResult<()>
重置密码 Read more
Source§async fn check_permission(
&self,
user_id: &str,
permission: &str,
) -> AuthResult<bool>
async fn check_permission( &self, user_id: &str, permission: &str, ) -> AuthResult<bool>
验证用户权限 Read more
Source§async fn get_user_roles(&self, user_id: &str) -> AuthResult<Vec<Role>>
async fn get_user_roles(&self, user_id: &str) -> AuthResult<Vec<Role>>
获取用户角色 Read more
Source§async fn assign_role(&self, user_id: &str, role_id: &str) -> AuthResult<()>
async fn assign_role(&self, user_id: &str, role_id: &str) -> AuthResult<()>
分配角色 Read more
Source§async fn remove_role(&self, user_id: &str, role_id: &str) -> AuthResult<()>
async fn remove_role(&self, user_id: &str, role_id: &str) -> AuthResult<()>
移除角色 Read more
Source§fn config(&self) -> &AuthConfig
fn config(&self) -> &AuthConfig
获取配置
Auto Trait Implementations§
impl Freeze for MemoryAuthService
impl !RefUnwindSafe for MemoryAuthService
impl Send for MemoryAuthService
impl Sync for MemoryAuthService
impl Unpin for MemoryAuthService
impl UnsafeUnpin for MemoryAuthService
impl !UnwindSafe for MemoryAuthService
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