pub struct SsoClient { /* private fields */ }Expand description
SSO 客户端 | SSO Client
每个应用作为 SSO 客户端,处理本地会话和票据验证 Each application acts as SSO Client, handling local sessions and ticket validation
Implementations§
Source§impl SsoClient
impl SsoClient
Sourcepub fn new(
manager: Arc<SaTokenManager>,
server_url: String,
service_url: String,
) -> Self
pub fn new( manager: Arc<SaTokenManager>, server_url: String, service_url: String, ) -> Self
创建新的 SSO 客户端 | Create a new SSO Client
§参数 | Parameters
manager- SaTokenManager 实例 | SaTokenManager instanceserver_url- SSO 服务端 URL | SSO Server URLservice_url- 当前服务 URL | Current service URL
Sourcepub fn with_logout_callback<F>(self, callback: F) -> Self
pub fn with_logout_callback<F>(self, callback: F) -> Self
设置登出回调函数 | Set logout callback
§参数 | Parameters
callback- 登出时执行的回调函数 | Callback function to execute on logout
Sourcepub fn get_login_url(&self) -> String
pub fn get_login_url(&self) -> String
生成登录 URL | Generate login URL
§返回 | Returns
SSO 服务端登录 URL,包含当前服务的回调地址 SSO Server login URL with current service callback
Sourcepub fn get_logout_url(&self) -> String
pub fn get_logout_url(&self) -> String
生成登出 URL | Generate logout URL
§返回 | Returns
SSO 服务端登出 URL,包含当前服务的回调地址 SSO Server logout URL with current service callback
Sourcepub async fn check_local_login(&self, login_id: &str) -> bool
pub async fn check_local_login(&self, login_id: &str) -> bool
Sourcepub async fn process_ticket(
&self,
ticket: &str,
service: &str,
) -> SaTokenResult<String>
pub async fn process_ticket( &self, ticket: &str, service: &str, ) -> SaTokenResult<String>
Sourcepub async fn login_by_ticket(&self, login_id: String) -> SaTokenResult<String>
pub async fn login_by_ticket(&self, login_id: String) -> SaTokenResult<String>
Sourcepub async fn handle_logout(&self, login_id: &str) -> SaTokenResult<()>
pub async fn handle_logout(&self, login_id: &str) -> SaTokenResult<()>
Sourcepub fn server_url(&self) -> &str
pub fn server_url(&self) -> &str
获取 SSO 服务端 URL | Get SSO Server URL
Sourcepub fn service_url(&self) -> &str
pub fn service_url(&self) -> &str
获取当前服务 URL | Get current service URL
Auto Trait Implementations§
impl Freeze for SsoClient
impl !RefUnwindSafe for SsoClient
impl Send for SsoClient
impl Sync for SsoClient
impl Unpin for SsoClient
impl !UnwindSafe for SsoClient
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more