Add auth_time

This commit is contained in:
Simon Bihel 2022-01-19 12:40:48 +00:00
parent 4390605586
commit d3d3f0163c
No known key found for this signature in database
GPG Key ID: B7013150BEAA28FD
2 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,6 @@
use anyhow::Result;
use async_trait::async_trait;
use chrono::{offset::Utc, DateTime};
use openidconnect::{Nonce, RedirectUrl};
use serde::{Deserialize, Serialize};
@ -21,6 +22,7 @@ pub struct CodeEntry {
pub address: String,
pub nonce: Option<Nonce>,
pub client_id: String,
pub auth_time: DateTime<Utc>,
}
#[derive(Clone, Serialize, Deserialize)]

View File

@ -214,7 +214,8 @@ pub async fn token(
StandardClaims::new(SubjectIdentifier::new(code_entry.address)),
EmptyAdditionalClaims {},
)
.set_nonce(code_entry.nonce);
.set_nonce(code_entry.nonce)
.set_auth_time(Some(code_entry.auth_time));
let pem = private_key
.to_pkcs1_pem()
@ -460,6 +461,7 @@ pub async fn sign_in(
nonce: params.oidc_nonce.clone(),
exchange_count: 0,
client_id: params.client_id.clone(),
auth_time: chrono::offset::Utc::now(),
};
let code = Uuid::new_v4();