use base64::Engine;
use chrono::{DateTime, Utc};
pub use crate::openhuman::credentials::session_support::get_session_token;
pub use crate::openhuman::credentials::{APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME};
pub fn bearer_authorization_value(token: &str) -> String {
format!("Bearer {}", token.trim())
}
pub fn decode_jwt_payload(token: &str) -> Option<serde_json::Value> { … 10 line(s) … }
pub fn decode_jwt_exp(token: &str) -> Option<DateTime<Utc>> { … 8 line(s) … }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_bearer_authorization_value() { … 22 line(s) … }
fn jwt_with_payload(payload_json: &str) -> String { … 5 line(s) … }
#[test]
fn decode_jwt_exp_reads_integer_exp() { … 7 line(s) … }
#[test]
fn decode_jwt_exp_reads_float_exp() { … 7 line(s) … }
#[test]
fn decode_jwt_exp_none_when_exp_absent() { … 4 line(s) … }
#[test]
fn decode_jwt_exp_none_for_non_jwt_or_garbage() { … 7 line(s) … }
}
[compacted tool output — this is a PARTIAL view; the full original (4490 bytes) is available by calling tokenjuice_retrieve with token "72a9fa15745dfefa792a0adf04d13794" (marker ⟦tj:72a9fa15745dfefa792a0adf04d13794⟧)]