making the internals of kanidmclientconfig public for other users (#2895)

* making the internals of kanidmclientconfig public for other users
* clippyisms
This commit is contained in:
James Hodgkinson 2024-07-15 03:28:23 -07:00 committed by GitHub
parent bf73332088
commit eddec88429
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 7 deletions

View file

@ -109,11 +109,13 @@ pub struct KanidmClientConfigInstance {
/// 3. All of these may be overridden by setting environment variables. /// 3. All of these may be overridden by setting environment variables.
/// ///
pub struct KanidmClientConfig { pub struct KanidmClientConfig {
// future editors, please leave this public so others can parse the config!
#[serde(flatten)] #[serde(flatten)]
default: KanidmClientConfigInstance, pub default: KanidmClientConfigInstance,
#[serde(flatten)] #[serde(flatten)]
instances: BTreeMap<String, KanidmClientConfigInstance>, // future editors, please leave this public so others can parse the config!
pub instances: BTreeMap<String, KanidmClientConfigInstance>,
} }
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]

View file

@ -1481,7 +1481,7 @@ impl AuthSession {
) { ) {
CredState::Success { auth_type, cred_id } => { CredState::Success { auth_type, cred_id } => {
// Issue the uat based on a set of factors. // Issue the uat based on a set of factors.
let uat = self.issue_uat(&auth_type, time, async_tx, cred_id)?; let uat = self.issue_uat(auth_type, time, async_tx, cred_id)?;
let jwt = Jws::into_json(&uat).map_err(|e| { let jwt = Jws::into_json(&uat).map_err(|e| {
admin_error!(?e, "Failed to serialise into Jws"); admin_error!(?e, "Failed to serialise into Jws");
@ -1546,7 +1546,7 @@ impl AuthSession {
fn issue_uat( fn issue_uat(
&mut self, &mut self,
auth_type: &AuthType, auth_type: AuthType,
time: Duration, time: Duration,
async_tx: &Sender<DelayedAction>, async_tx: &Sender<DelayedAction>,
cred_id: Uuid, cred_id: Uuid,
@ -1614,7 +1614,7 @@ impl AuthSession {
issued_at: uat.issued_at, issued_at: uat.issued_at,
issued_by: IdentityId::User(self.account.uuid), issued_by: IdentityId::User(self.account.uuid),
scope, scope,
type_: *auth_type, type_: auth_type,
})) }))
.map_err(|e| { .map_err(|e| {
debug!(?e, "queue failure"); debug!(?e, "queue failure");

View file

@ -112,7 +112,7 @@ impl ValueSetSession {
type_, type_,
} => { } => {
// Convert things. // Convert things.
let issued_at = OffsetDateTime::parse(&issued_at, &Rfc3339) let issued_at = OffsetDateTime::parse(issued_at, &Rfc3339)
.map(|odt| odt.to_offset(time::UtcOffset::UTC)) .map(|odt| odt.to_offset(time::UtcOffset::UTC))
.map_err(|e| { .map_err(|e| {
admin_error!( admin_error!(
@ -125,7 +125,7 @@ impl ValueSetSession {
let state = match state { let state = match state {
DbValueSessionStateV1::ExpiresAt(e_inner) => { DbValueSessionStateV1::ExpiresAt(e_inner) => {
OffsetDateTime::parse(&e_inner, &Rfc3339) OffsetDateTime::parse(e_inner, &Rfc3339)
.map(|odt| odt.to_offset(time::UtcOffset::UTC)) .map(|odt| odt.to_offset(time::UtcOffset::UTC))
.map(SessionState::ExpiresAt) .map(SessionState::ExpiresAt)
.map_err(|e| { .map_err(|e| {

View file

@ -139,6 +139,7 @@ pub enum AuthCacheAction {
} }
#[async_trait] #[async_trait]
#[allow(clippy::too_many_arguments)]
pub trait IdProvider { pub trait IdProvider {
async fn configure_hsm_keys( async fn configure_hsm_keys(
&self, &self,