pub struct SsoServer { /* private fields */ }Expand description
SSO 服务端 | SSO Server
中央认证服务,负责票据生成、验证和会话管理 Central authentication service responsible for ticket generation, validation, and session management
Implementations§
Source§impl SsoServer
impl SsoServer
Sourcepub fn new(manager: Arc<SaTokenManager>) -> Self
pub fn new(manager: Arc<SaTokenManager>) -> Self
创建新的 SSO 服务端 | Create a new SSO Server
§参数 | Parameters
manager- SaTokenManager 实例 | SaTokenManager instance
Sourcepub fn with_ticket_timeout(self, timeout: i64) -> Self
pub fn with_ticket_timeout(self, timeout: i64) -> Self
Sourcepub async fn is_logged_in(&self, login_id: &str) -> bool
pub async fn is_logged_in(&self, login_id: &str) -> bool
检查用户是否已登录 | Check if user is logged in
通过检查 SSO 会话是否存在来判断 Determined by checking if SSO session exists
Sourcepub async fn create_ticket(
&self,
login_id: String,
service: String,
) -> SaTokenResult<SsoTicket>
pub async fn create_ticket( &self, login_id: String, service: String, ) -> SaTokenResult<SsoTicket>
Sourcepub async fn validate_ticket(
&self,
ticket_id: &str,
service: &str,
) -> SaTokenResult<String>
pub async fn validate_ticket( &self, ticket_id: &str, service: &str, ) -> SaTokenResult<String>
验证票据 | Validate ticket
验证票据的有效性并将其标记为已使用(一次性使用) Validates ticket and marks it as used (one-time use)
§参数 | Parameters
ticket_id- 票据 ID | Ticket IDservice- 请求的服务 URL | Requested service URL
§返回 | Returns
用户登录 ID | User login ID
§错误 | Errors
InvalidTicket- 票据不存在 | Ticket not foundTicketExpired- 票据已过期或已使用 | Ticket expired or usedServiceMismatch- 服务 URL 不匹配 | Service URL mismatch
Sourcepub async fn get_session(&self, login_id: &str) -> Option<SsoSession>
pub async fn get_session(&self, login_id: &str) -> Option<SsoSession>
Sourcepub async fn check_session(&self, login_id: &str) -> bool
pub async fn check_session(&self, login_id: &str) -> bool
Sourcepub async fn cleanup_expired_tickets(&self)
pub async fn cleanup_expired_tickets(&self)
清理过期票据 | Cleanup expired tickets
删除所有过期或已使用的票据 Removes all expired or used tickets
Auto Trait Implementations§
impl Freeze for SsoServer
impl !RefUnwindSafe for SsoServer
impl Send for SsoServer
impl Sync for SsoServer
impl Unpin for SsoServer
impl !UnwindSafe for SsoServer
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