pub struct TokenManager { /* private fields */ }Implementations§
Source§impl TokenManager
impl TokenManager
Sourcepub fn new(secret: &[u8], issuer: Option<String>) -> Self
pub fn new(secret: &[u8], issuer: Option<String>) -> Self
Creates a TokenManager for symmetric signing (HS256).
Sourcepub fn new_asymmetric(
private_key_pem: &[u8],
issuer: Option<String>,
kid: Option<String>,
) -> Result<Self, AuthError>
pub fn new_asymmetric( private_key_pem: &[u8], issuer: Option<String>, kid: Option<String>, ) -> Result<Self, AuthError>
Creates a TokenManager for asymmetric signing (RS256).
private_key_pem must be a valid RSA private key in PEM format.
OP/external verification should use this path; internal resource servers
can continue to use new (HS256).
pub fn public_jwk(&self) -> Option<Jwk>
pub fn with_issuer(self, issuer: String) -> Self
Sourcepub fn issue_user_token(
&self,
identity: Identity,
expires_in_secs: u64,
scope: Option<String>,
aud: Option<String>,
) -> Result<String, AuthError>
pub fn issue_user_token( &self, identity: Identity, expires_in_secs: u64, scope: Option<String>, aud: Option<String>, ) -> Result<String, AuthError>
Issues a token for a user identity.
Sourcepub fn issue_id_token(
&self,
identity: Identity,
client_id: &str,
nonce: Option<String>,
expires_in_secs: u64,
) -> Result<String, AuthError>
pub fn issue_id_token( &self, identity: Identity, client_id: &str, nonce: Option<String>, expires_in_secs: u64, ) -> Result<String, AuthError>
Issues an OIDC-conformant ID token.
Sourcepub fn issue_client_token(
&self,
client_id: &str,
expires_in_secs: u64,
scope: Option<String>,
aud: Option<String>,
) -> Result<String, AuthError>
pub fn issue_client_token( &self, client_id: &str, expires_in_secs: u64, scope: Option<String>, aud: Option<String>, ) -> Result<String, AuthError>
Issues a machine-to-machine (M2M) token for a client.
pub fn validate_token( &self, token: &str, expected_aud: Option<&str>, ) -> Result<Claims, AuthError>
Trait Implementations§
Source§impl Clone for TokenManager
impl Clone for TokenManager
Source§fn clone(&self) -> TokenManager
fn clone(&self) -> TokenManager
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 moreAuto Trait Implementations§
impl Freeze for TokenManager
impl RefUnwindSafe for TokenManager
impl Send for TokenManager
impl Sync for TokenManager
impl Unpin for TokenManager
impl UnsafeUnpin for TokenManager
impl UnwindSafe for TokenManager
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