pub struct IssuedSession {
pub session: Session,
pub tokens: IssuedSessionTokens,
}Expand description
Result of issuing a brand-new session.
This value keeps the persisted session record together with the client-facing token material produced for it.
§Examples
use std::time::{Duration, SystemTime};
use webgates_sessions::services::IssuedSession;
use webgates_sessions::session::{Session, SessionFamilyId};
use webgates_sessions::tokens::{
AuthToken, IssuedSessionTokens, IssuedTokenPair, RefreshTokenHash,
RefreshTokenPlaintext,
};
let now = SystemTime::UNIX_EPOCH + Duration::from_secs(1_000);
let session = Session::new(
SessionFamilyId::new(),
"user-42",
now,
now + Duration::from_secs(3_600),
);
let tokens = IssuedSessionTokens::new(
IssuedTokenPair::new(
AuthToken::new("auth-token-value").unwrap(),
RefreshTokenPlaintext::new("a".repeat(64)).unwrap(),
),
RefreshTokenHash::new("abc123def456").unwrap(),
);
let issued = IssuedSession::new(session.clone(), tokens);
assert_eq!(issued.session, session);Fields§
§session: SessionNewly created session state.
tokens: IssuedSessionTokensIssued auth and refresh tokens plus the persisted refresh-token hash.
Implementations§
Source§impl IssuedSession
impl IssuedSession
Sourcepub fn new(session: Session, tokens: IssuedSessionTokens) -> Self
pub fn new(session: Session, tokens: IssuedSessionTokens) -> Self
Creates a new issued-session result.
Trait Implementations§
Source§impl Clone for IssuedSession
impl Clone for IssuedSession
Source§fn clone(&self) -> IssuedSession
fn clone(&self) -> IssuedSession
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IssuedSession
impl Debug for IssuedSession
Source§impl PartialEq for IssuedSession
impl PartialEq for IssuedSession
Source§fn eq(&self, other: &IssuedSession) -> bool
fn eq(&self, other: &IssuedSession) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for IssuedSession
impl StructuralPartialEq for IssuedSession
Auto Trait Implementations§
impl Freeze for IssuedSession
impl RefUnwindSafe for IssuedSession
impl Send for IssuedSession
impl Sync for IssuedSession
impl Unpin for IssuedSession
impl UnsafeUnpin for IssuedSession
impl UnwindSafe for IssuedSession
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