Fix update intent ttl parameters (#2540)

This commit is contained in:
Firstyear 2024-02-16 17:02:36 +10:00 committed by GitHub
parent faec47d13f
commit 816fde766f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View file

@ -1665,7 +1665,7 @@ impl KanidmClient {
) -> Result<CUIntentToken, ClientError> { ) -> Result<CUIntentToken, ClientError> {
if let Some(ttl) = ttl { if let Some(ttl) = ttl {
self.perform_get_request(&format!( self.perform_get_request(&format!(
"/v1/person/{}/_credential/_update_intent?ttl={}", "/v1/person/{}/_credential/_update_intent/{}",
id, ttl id, ttl
)) ))
.await .await

View file

@ -1,6 +1,6 @@
//! The V1 API things! //! The V1 API things!
use axum::extract::{Path, Query, State}; use axum::extract::{Path, State};
use axum::http::{HeaderMap, HeaderValue}; use axum::http::{HeaderMap, HeaderValue};
use axum::middleware::from_fn; use axum::middleware::from_fn;
use axum::response::{IntoResponse, Response}; use axum::response::{IntoResponse, Response};
@ -1108,7 +1108,7 @@ pub async fn person_id_credential_update_get(
#[utoipa::path( #[utoipa::path(
get, get,
path = "/v1/person/{id}/_credential/_update_intent/?ttl={ttl}", path = "/v1/person/{id}/_credential/_update_intent/{ttl}",
params( params(
("ttl" = u64, description="The new TTL for the credential?") ("ttl" = u64, description="The new TTL for the credential?")
), ),
@ -1125,8 +1125,7 @@ pub async fn person_id_credential_update_intent_ttl_get(
State(state): State<ServerState>, State(state): State<ServerState>,
Extension(kopid): Extension<KOpId>, Extension(kopid): Extension<KOpId>,
VerifiedClientInformation(client_auth_info): VerifiedClientInformation, VerifiedClientInformation(client_auth_info): VerifiedClientInformation,
Path(id): Path<String>, Path((id, ttl)): Path<(String, u64)>,
Query(ttl): Query<u64>,
) -> Result<Json<CUIntentToken>, WebError> { ) -> Result<Json<CUIntentToken>, WebError> {
state state
.qe_w_ref .qe_w_ref
@ -2937,7 +2936,7 @@ pub(crate) fn route_setup(state: ServerState) -> Router<ServerState> {
get(person_id_credential_update_get), get(person_id_credential_update_get),
) )
.route( .route(
"/v1/person/:id/_credential/_update_intent/:ttl", // TODO: I'm pretty sure this route is wrong, because we match the query not the path "/v1/person/:id/_credential/_update_intent/:ttl",
get(person_id_credential_update_intent_ttl_get), get(person_id_credential_update_intent_ttl_get),
) )
.route( .route(