pub struct SecurityTokenService { /* private fields */ }Expand description
WS-Trust Security Token Service
Persistence. SecurityTokenService::process_request keeps issued tokens in an
in-memory HashMap: they are lost on restart and not shared across instances.
SecurityTokenService::with_storage plus
SecurityTokenService::process_request_stored keep them in the AuthStorage KV
layer instead (key wstrust:token:<id>, expiring with the token), so a restart or a
second instance sees the same tokens. The stored record holds the token content and any
proof-of-possession key material, so give the STS an encrypted storage
(EncryptedStorage) in production.
Implementations§
Source§impl SecurityTokenService
impl SecurityTokenService
Sourcepub fn with_storage(self, storage: Arc<dyn AuthStorage>) -> Self
pub fn with_storage(self, storage: Arc<dyn AuthStorage>) -> Self
Persist issued tokens in storage when requests go through
process_request_stored.
Sourcepub async fn process_request_stored(
&mut self,
request: RequestSecurityToken,
) -> Result<RequestSecurityTokenResponse>
pub async fn process_request_stored( &mut self, request: RequestSecurityToken, ) -> Result<RequestSecurityTokenResponse>
Process a request with the token store as the source of truth.
Issue and Renew write the new token to storage (expiring with it), Cancel deletes it,
Validate and Renew read it from storage, so a restarted or second STS instance sees the
same tokens. A token that cannot be stored is not returned. Without
with_storage this is process_request.
Two instances renewing the same token at the same moment each issue their own new token; the old one is not consumed by a renewal, as before.
Sourcepub fn process_request(
&mut self,
request: RequestSecurityToken,
) -> Result<RequestSecurityTokenResponse>
pub fn process_request( &mut self, request: RequestSecurityToken, ) -> Result<RequestSecurityTokenResponse>
Process a WS-Trust Request Security Token
Sourcepub fn create_rst_soap_request(
&self,
request: &RequestSecurityToken,
username: &str,
password: Option<&str>,
) -> Result<String>
pub fn create_rst_soap_request( &self, request: &RequestSecurityToken, username: &str, password: Option<&str>, ) -> Result<String>
Create a complete WS-Trust SOAP request
Auto Trait Implementations§
impl !RefUnwindSafe for SecurityTokenService
impl !UnwindSafe for SecurityTokenService
impl Forget for SecurityTokenService
impl Freeze for SecurityTokenService
impl Send for SecurityTokenService
impl Sync for SecurityTokenService
impl Unpin for SecurityTokenService
impl UnsafeUnpin for SecurityTokenService
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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