-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extract the expiration from the token, show for refresh token
- Loading branch information
Showing
5 changed files
with
134 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use openid::{CompactJson, SingleOrMultiple}; | ||
use serde::{Deserialize, Serialize}; | ||
use serde_json::Value; | ||
use url::Url; | ||
|
||
/// Access token claims | ||
#[derive(Clone, Debug, Deserialize, Serialize)] | ||
pub struct AccessTokenClaims { | ||
#[serde(default)] | ||
pub azp: Option<String>, | ||
pub sub: String, | ||
pub iss: Url, | ||
#[serde(default, skip_serializing_if = "Option::is_none")] | ||
pub aud: Option<SingleOrMultiple<String>>, | ||
|
||
#[serde(default)] | ||
pub exp: Option<i64>, | ||
#[serde(default)] | ||
pub iat: Option<i64>, | ||
#[serde(default)] | ||
pub auth_time: Option<i64>, | ||
|
||
#[serde(flatten)] | ||
pub extended_claims: Value, | ||
|
||
#[serde(default, skip_serializing_if = "String::is_empty")] | ||
pub scope: String, | ||
} | ||
|
||
impl CompactJson for AccessTokenClaims {} | ||
|
||
/// Access token claims | ||
#[derive(Clone, Debug, Deserialize, Serialize)] | ||
pub struct RefreshTokenClaims { | ||
#[serde(default)] | ||
pub exp: Option<i64>, | ||
|
||
#[serde(flatten)] | ||
pub extended_claims: Value, | ||
} | ||
|
||
impl CompactJson for RefreshTokenClaims {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#![deny(clippy::unwrap_used)] | ||
#![deny(clippy::expect_used)] | ||
|
||
mod claims; | ||
mod cmd; | ||
mod config; | ||
mod http; | ||
|