mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
User auth token session display implementation (#1415)
* removed old todo from #62 * implemented proper display for user_auth_token_session * auth-token-session display fixes * updated contributors list --------- Co-authored-by: Firstyear <william@blackhats.net.au>
This commit is contained in:
parent
5573ab9224
commit
36f1efa559
|
@ -25,6 +25,7 @@
|
||||||
- Yuxuan Lu (leoleoasd)
|
- Yuxuan Lu (leoleoasd)
|
||||||
- h7x4
|
- h7x4
|
||||||
- Pi-Cla
|
- Pi-Cla
|
||||||
|
- Sebastiano Tocci(Seba-T)
|
||||||
|
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,6 @@ impl QueryServerReadV1 {
|
||||||
uat: Option<String>,
|
uat: Option<String>,
|
||||||
eventid: Uuid,
|
eventid: Uuid,
|
||||||
) -> Result<WhoamiResponse, OperationError> {
|
) -> Result<WhoamiResponse, OperationError> {
|
||||||
// TODO #62: Move this to IdmServer!!!
|
|
||||||
// Begin a read
|
// Begin a read
|
||||||
let ct = duration_from_epoch_now();
|
let ct = duration_from_epoch_now();
|
||||||
let mut idms_prox_read = self.idms.proxy_read().await;
|
let mut idms_prox_read = self.idms.proxy_read().await;
|
||||||
|
@ -301,7 +300,6 @@ impl QueryServerReadV1 {
|
||||||
admin_error!(?e, "Invalid identity");
|
admin_error!(?e, "Invalid identity");
|
||||||
e
|
e
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let srch =
|
let srch =
|
||||||
SearchEvent::from_whoami_request(ident, &idms_prox_read.qs_read).map_err(|e| {
|
SearchEvent::from_whoami_request(ident, &idms_prox_read.qs_read).map_err(|e| {
|
||||||
admin_error!(?e, "Failed to begin whoami");
|
admin_error!(?e, "Failed to begin whoami");
|
||||||
|
|
|
@ -8,9 +8,11 @@ use crate::prelude::*;
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use std::fmt::Formatter;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use crate::valueset::uuid_to_proto_string;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use base64::{engine::general_purpose, Engine as _};
|
use base64::{engine::general_purpose, Engine as _};
|
||||||
use compact_jwt::JwsSigner;
|
use compact_jwt::JwsSigner;
|
||||||
|
@ -766,7 +768,7 @@ impl TryInto<UatPurposeStatus> for SessionScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, PartialEq, Eq)]
|
||||||
pub struct Session {
|
pub struct Session {
|
||||||
pub label: String,
|
pub label: String,
|
||||||
pub expiry: Option<OffsetDateTime>,
|
pub expiry: Option<OffsetDateTime>,
|
||||||
|
@ -776,6 +778,25 @@ pub struct Session {
|
||||||
pub scope: SessionScope,
|
pub scope: SessionScope,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for Session {
|
||||||
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||||
|
let issuer = match self.issued_by {
|
||||||
|
IdentityId::User(u) => format!("User - {}", uuid_to_proto_string(u)),
|
||||||
|
IdentityId::Synch(u) => format!("Synch - {}", uuid_to_proto_string(u)),
|
||||||
|
IdentityId::Internal => "Internal".to_string(),
|
||||||
|
};
|
||||||
|
let expiry = match self.expiry {
|
||||||
|
Some(e) => e.to_string(),
|
||||||
|
None => "never".to_string(),
|
||||||
|
};
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"expiry: {}, issued at: {}, issued by: {}, credential id: {}, scope: {:?}",
|
||||||
|
expiry, self.issued_at, issuer, self.cred_id, self.scope
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Oauth2Session {
|
pub struct Oauth2Session {
|
||||||
pub parent: Uuid,
|
pub parent: Uuid,
|
||||||
|
|
Loading…
Reference in a new issue