Skip to main content

SsoServer

Struct SsoServer 

Source
pub struct SsoServer { /* private fields */ }
Expand description

SSO server: tickets, sessions, SLO. SSO 服务端:票据、会话、统一登出。

Implementations§

Source§

impl SsoServer

Source

pub fn new(manager: Arc<SaTokenManager>) -> Self

Create a server from a manager (strict origin defaults). 从 manager 创建服务端(严格的 Origin 默认值)。

Source

pub fn with_config(self, config: &SsoConfig) -> Self

Apply SSO config (timeout, origins, sign). 应用 SSO 配置(超时、白名单、签名)。

Source

pub fn with_ticket_timeout(self, timeout: i64) -> Self

Override ticket timeout seconds. 覆盖票据超时秒数。

Source

pub fn with_slo_notifier(self, notifier: Arc<dyn SloNotifier>) -> Self

Replace the SLO notifier (default NoopSloNotifier). 替换 SLO 通知器(默认 NoopSloNotifier)。

Source

pub fn sign(&self) -> &RequestSign

Shared request signer. 共享请求签名器。

Source

pub fn is_allowed_origin(&self, origin: &str) -> bool

Exact-match origin check (requires allow_cross_domain). 精确匹配 Origin 校验(需开启 allow_cross_domain)。

Source

pub async fn create_ticket( &self, login_id: String, service: String, ) -> SaTokenResult<SsoTicket>

Create and persist a ticket; upsert session client. 创建并持久化票据;upsert 会话客户端。

Source

pub async fn validate_ticket( &self, ticket_id: &str, service: &str, ) -> SaTokenResult<String>

Consume a ticket and return login_id. 消费票据并返回 login_id。

Source

pub async fn check_ticket( &self, ticket_id: &str, service: &str, ) -> SaTokenResult<CheckTicketResult>

Non-consuming ticket check. 非消费票据校验。

Source

pub fn build_slo_logout_urls(client_urls: &[String]) -> Vec<String>

Build per-client SLO callback URLs. 构造各客户端 SLO 回调 URL。

Source

pub async fn logout_with_slo( &self, login_id: &str, ) -> SaTokenResult<Vec<String>>

Local logout then notify clients (failures are logged, not rolled back). 先本地登出再通知客户端(失败仅日志,不回滚)。

Source

pub async fn login( &self, login_id: String, service: String, ) -> SaTokenResult<SsoTicket>

Login at SSO server and issue a ticket for service. 在 SSO 服务端登录并为 service 签发票据。

Source

pub async fn logout(&self, login_id: &str) -> SaTokenResult<Vec<String>>

Remove SSO session and logout related login types. 删除 SSO 会话并登出相关 login_type。

Source

pub async fn get_session(&self, login_id: &str) -> Option<SsoSession>

Load session if present. 若存在则加载会话。

Source

pub async fn check_session(&self, login_id: &str) -> bool

True when a session exists. 存在会话时为 true。

Source

pub async fn cleanup_expired_tickets(&self)

No-op: ticket TTL is enforced by storage. 空操作:票据 TTL 由存储过期保证。

Source

pub async fn get_active_clients(&self, login_id: &str) -> Vec<String>

Active client URLs for login_id. login_id 的活跃客户端 URL。

Source

pub async fn is_logged_in(&self, login_id: &str) -> bool

Session present and SSO login_type still has tokens. 会话存在且 SSO login_type 仍有 token。

Trait Implementations§

Source§

impl Debug for SsoServer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ForyObject for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more