Struct oxide_auth::primitives::issuer::IssuedToken [−][src]
pub struct IssuedToken {
pub token: String,
pub refresh: Option<String>,
pub until: DateTime<Utc>,
pub token_type: TokenType,
}Expand description
Token parameters returned to a client.
Fields
token: StringThe bearer token
refresh: Option<String>The refresh token, if any.
until: DateTime<Utc>Expiration timestamp (Utc).
Technically, a time to live is expected in the response but this will be transformed later. In a direct backend access situation, this enables high precision timestamps.
token_type: TokenTypeThe type of the token.
Implementations
Construct a token that can not be refreshed.
This is essential for issuers that can not revoke their tokens. Since refresh tokens are both long-lived and more powerful than their access token counterparts, it is more dangerous to have an unrevokable refresh token.
This is only a shorthand for initializing the IssuedToken with None for refresh.
use oxide_auth::primitives::grant::Grant;
use oxide_auth::primitives::issuer::{Issuer, IssuedToken};
struct MyIssuer;
impl MyIssuer {
fn access_token(&mut self, grant: &Grant) -> String {
// .. your implementation
}
}
impl Issuer for MyIssuer {
fn issue(&mut self, mut grant: Grant) -> Result<IssuedToken, ()> {
let token = self.access_token(&grant);
Ok(IssuedToken::without_refresh(token, grant.until))
}
// …
}Determine if the access token can be refreshed.
This returns false if refresh is None and true otherwise.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for IssuedToken
impl Send for IssuedToken
impl Sync for IssuedToken
impl Unpin for IssuedToken
impl UnwindSafe for IssuedToken
Blanket Implementations
Mutably borrows from an owned value. Read more