mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
Add missing schemas to get OpenAPI validation to pass. (#3129)
This commit is contained in:
parent
7eb54be487
commit
8b4d0d6ead
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3319,6 +3319,7 @@ dependencies = [
|
||||||
"serde_with",
|
"serde_with",
|
||||||
"smartstring",
|
"smartstring",
|
||||||
"sshkey-attest",
|
"sshkey-attest",
|
||||||
|
"sshkeys",
|
||||||
"time",
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
|
|
|
@ -264,6 +264,7 @@ shellexpand = "^2.1.2"
|
||||||
smartstring = "^1.0.1"
|
smartstring = "^1.0.1"
|
||||||
smolset = "^1.3.1"
|
smolset = "^1.3.1"
|
||||||
sshkey-attest = "^0.5.0"
|
sshkey-attest = "^0.5.0"
|
||||||
|
sshkeys = "0.3.3"
|
||||||
svg = "0.13.1"
|
svg = "0.13.1"
|
||||||
syn = { version = "2.0.82", features = ["full"] }
|
syn = { version = "2.0.82", features = ["full"] }
|
||||||
tempfile = "3.13.0"
|
tempfile = "3.13.0"
|
||||||
|
|
|
@ -37,6 +37,7 @@ utoipa = { workspace = true }
|
||||||
uuid = { workspace = true, features = ["serde"] }
|
uuid = { workspace = true, features = ["serde"] }
|
||||||
webauthn-rs-proto = { workspace = true }
|
webauthn-rs-proto = { workspace = true }
|
||||||
sshkey-attest = { workspace = true }
|
sshkey-attest = { workspace = true }
|
||||||
|
sshkeys = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
enum-iterator = { workspace = true }
|
enum-iterator = { workspace = true }
|
||||||
|
|
|
@ -188,6 +188,7 @@ pub enum Attribute {
|
||||||
TestNotAllowed,
|
TestNotAllowed,
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
#[schema(value_type = String)]
|
||||||
Custom(AttrString),
|
Custom(AttrString),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sshkey_attest::proto::PublicKey as SshPublicKey;
|
use sshkey_attest::proto::PublicKey as SshPublicKey;
|
||||||
|
use sshkeys::{KeyType, KeyTypeKind, PublicKeyKind};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use utoipa::ToSchema;
|
use utoipa::ToSchema;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
@ -8,6 +9,35 @@ use serde_with::skip_serializing_none;
|
||||||
|
|
||||||
use crate::constants::{ATTR_GROUP, ATTR_LDAP_SSHPUBLICKEY};
|
use crate::constants::{ATTR_GROUP, ATTR_LDAP_SSHPUBLICKEY};
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[derive(ToSchema)]
|
||||||
|
#[schema(as = KeyTypeKind)]
|
||||||
|
pub struct KeyTypeKindSchema(KeyTypeKind);
|
||||||
|
|
||||||
|
#[derive(ToSchema)]
|
||||||
|
#[schema(as = KeyType)]
|
||||||
|
pub struct KeyTypeSchema {
|
||||||
|
pub name: &'static str,
|
||||||
|
pub short_name: &'static str,
|
||||||
|
pub is_cert: bool,
|
||||||
|
pub is_sk: bool,
|
||||||
|
pub kind: KeyTypeKind,
|
||||||
|
pub plain: &'static str,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[derive(ToSchema)]
|
||||||
|
#[schema(as = PublicKeyKind)]
|
||||||
|
pub struct PublicKeyKindSchema(PublicKeyKind);
|
||||||
|
|
||||||
|
#[derive(ToSchema)]
|
||||||
|
#[schema(as = SshPublicKey)]
|
||||||
|
pub struct SshPublicKeySchema {
|
||||||
|
pub key_type: KeyType,
|
||||||
|
pub kind: PublicKeyKind,
|
||||||
|
pub comment: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
/// A token representing the details of a unix group
|
/// A token representing the details of a unix group
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, ToSchema)]
|
#[derive(Debug, Serialize, Deserialize, Clone, ToSchema)]
|
||||||
pub struct UnixGroupToken {
|
pub struct UnixGroupToken {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use axum::{middleware::from_fn, response::Redirect, routing::get, Router};
|
use axum::{middleware::from_fn, response::Redirect, routing::get, Router};
|
||||||
use kanidm_proto::{internal, scim_v1, v1};
|
use kanidm_proto::{attribute, internal, scim_v1, v1};
|
||||||
use utoipa::{
|
use utoipa::{
|
||||||
openapi::security::{HttpAuthScheme, HttpBuilder, SecurityScheme},
|
openapi::security::{HttpAuthScheme, HttpBuilder, SecurityScheme},
|
||||||
Modify, OpenApi,
|
Modify, OpenApi,
|
||||||
|
@ -209,7 +209,7 @@ impl Modify for SecurityAddon {
|
||||||
),
|
),
|
||||||
components(
|
components(
|
||||||
schemas(
|
schemas(
|
||||||
// kanidm_proto::attribute::Attribute,
|
attribute::Attribute,
|
||||||
|
|
||||||
|
|
||||||
scim_v1::ScimSyncState,
|
scim_v1::ScimSyncState,
|
||||||
|
@ -223,6 +223,7 @@ impl Modify for SecurityAddon {
|
||||||
internal::ApiToken,
|
internal::ApiToken,
|
||||||
internal::ApiTokenPurpose,
|
internal::ApiTokenPurpose,
|
||||||
internal::BackupCodesView,
|
internal::BackupCodesView,
|
||||||
|
internal::ConsistencyError,
|
||||||
internal::CreateRequest,
|
internal::CreateRequest,
|
||||||
internal::CredentialDetail,
|
internal::CredentialDetail,
|
||||||
internal::CredentialDetailType,
|
internal::CredentialDetailType,
|
||||||
|
@ -263,7 +264,11 @@ impl Modify for SecurityAddon {
|
||||||
v1::AuthStep,
|
v1::AuthStep,
|
||||||
v1::Entry,
|
v1::Entry,
|
||||||
v1::GroupUnixExtend,
|
v1::GroupUnixExtend,
|
||||||
|
v1::PublicKeyKindSchema,
|
||||||
v1::SingleStringRequest,
|
v1::SingleStringRequest,
|
||||||
|
v1::SshPublicKeySchema,
|
||||||
|
v1::KeyTypeKindSchema,
|
||||||
|
v1::KeyTypeSchema,
|
||||||
internal::UiHint,
|
internal::UiHint,
|
||||||
v1::UatPurposeStatus,
|
v1::UatPurposeStatus,
|
||||||
v1::UatStatus,
|
v1::UatStatus,
|
||||||
|
|
|
@ -347,7 +347,7 @@ async fn scim_entry_id_get(
|
||||||
),
|
),
|
||||||
security(("token_jwt" = [])),
|
security(("token_jwt" = [])),
|
||||||
tag = "scim",
|
tag = "scim",
|
||||||
operation_id = "scim_entry_id_get"
|
operation_id = "scim_person_id_get"
|
||||||
)]
|
)]
|
||||||
async fn scim_person_id_get(
|
async fn scim_person_id_get(
|
||||||
State(state): State<ServerState>,
|
State(state): State<ServerState>,
|
||||||
|
|
Loading…
Reference in a new issue