From 2193e4d6cf9d230e493e6a6948bfd44f667aeaf4 Mon Sep 17 00:00:00 2001 From: jbtrystram Date: Wed, 23 Nov 2022 12:01:30 +0100 Subject: [PATCH] [refactor] drop unused whoami path and drop redundant endpoints info resources --- console-backend/api/index.yaml | 24 ------------------------ console-backend/src/admin.rs | 9 --------- console-backend/src/info.rs | 8 ++------ console-backend/src/lib.rs | 13 ------------- 4 files changed, 2 insertions(+), 52 deletions(-) delete mode 100644 console-backend/src/admin.rs diff --git a/console-backend/api/index.yaml b/console-backend/api/index.yaml index eb99f1dce..c82c7b285 100644 --- a/console-backend/api/index.yaml +++ b/console-backend/api/index.yaml @@ -360,30 +360,6 @@ paths: # ## Admin # - /api/admin/v1alpha1/user/whoami: - get: - tags: - - User administration - description: Get information about the current user. - responses: - 200: - description: Information about the current user. - content: - 'application/json': - schema: - type: object - properties: - id: - type: string - description: | - The ID of the current user. - - NOTE: This ID may be different to the name of the user. - required: - - id - 403: - description: In case the user is not logged in. - /api/admin/v1alpha1/apps/{application}/transfer-ownership: parameters: - $ref: '#/components/parameters/ApplicationName' diff --git a/console-backend/src/admin.rs b/console-backend/src/admin.rs deleted file mode 100644 index 25c5509fa..000000000 --- a/console-backend/src/admin.rs +++ /dev/null @@ -1,9 +0,0 @@ -use actix_web::HttpResponse; -use drogue_cloud_service_api::auth::user::UserInformation; -use serde_json::json; - -pub async fn whoami(user: UserInformation) -> Result { - Ok(HttpResponse::Ok().json(json!({ - "id": user.user_id(), - }))) -} diff --git a/console-backend/src/info.rs b/console-backend/src/info.rs index 13d9eb25a..6bbf63307 100644 --- a/console-backend/src/info.rs +++ b/console-backend/src/info.rs @@ -21,7 +21,8 @@ impl DemoFetcher { } } -pub async fn get_info( +#[get("/drogue-endpoints")] +pub async fn get_public_endpoints( endpoints: web::Data, demos: web::Data, ) -> impl Responder { @@ -32,11 +33,6 @@ pub async fn get_info( HttpResponse::Ok().json(info) } -#[get("/drogue-endpoints")] -pub async fn get_public_endpoints(endpoints: web::Data) -> impl Responder { - HttpResponse::Ok().json(endpoints) -} - #[get("/drogue-version")] pub async fn get_drogue_version() -> impl Responder { HttpResponse::Ok().json(json!({ diff --git a/console-backend/src/lib.rs b/console-backend/src/lib.rs index cdc22f777..9ee7dc348 100644 --- a/console-backend/src/lib.rs +++ b/console-backend/src/lib.rs @@ -1,4 +1,3 @@ -mod admin; mod api; mod demos; mod info; @@ -222,19 +221,7 @@ pub async fn configurator( >), )), ) - .service( - web::scope("/api/admin/v1alpha1") - .wrap(auth.clone()) - .service(web::resource("/user/whoami").route(web::get().to(admin::whoami))), - ) // everything from here on is unauthenticated or not using the middleware - .service( - web::scope("/api/console/v1alpha1").service( - web::resource("/info") - .wrap(auth) - .route(web::get().to(info::get_info)), - ), - ) .service(index) .service( web::scope("/.well-known")