summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2025-01-26 12:25:13 +0100
committerniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2025-01-26 12:25:13 +0100
commit5898e5ab4359945ef52dc7460bb2937a85603fc2 (patch)
tree0ef4c760bd6e30df2897e9cc725552ef54e51983 /src/main.rs
parente3f0f700bf2de3b8e7d7c72893a4d6cb128f000d (diff)
authentication done
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/main.rs b/src/main.rs
index 595723a..941df3a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,13 +8,13 @@ use dotenv::dotenv;
use std::env;
use std::sync::Arc;
-use utoipa::{
- openapi::security::{HttpAuthScheme, HttpBuilder, SecurityScheme},
- Modify, OpenApi, ToSchema,
-};
-
-use utoipa_swagger_ui::SwaggerUi;
-use database::artist::Artist;
+// use utoipa::{
+// openapi::security::{HttpAuthScheme, HttpBuilder, SecurityScheme},
+// Modify, OpenApi,
+// };
+//
+// use utoipa_swagger_ui::SwaggerUi;
+// use database::artist::Artist;
#[derive(Clone)]
struct AppState {
@@ -48,47 +48,47 @@ async fn main() -> std::io::Result<()> {
secret: jwt_secret,
};
- /* utoipa setup */
- #[derive(OpenApi)]
- #[openapi(
- paths(
- ),
- components(
- schemas(
- Artist
- )
- ),
- modifiers(&SecurityAddon)
- )]
- struct ApiDoc;
+ // /* utoipa setup */
+ // #[derive(OpenApi)]
+ // #[openapi(
+ // paths(
+ // ),
+ // components(
+ // schemas(
+ // Artist
+ // )
+ // ),
+ // modifiers(&SecurityAddon)
+ // )]
+ // struct ApiDoc;
- struct SecurityAddon;
- impl Modify for SecurityAddon {
- fn modify(&self, openapi : &mut utoipa::openapi::OpenApi) {
- let components = openapi.components.as_mut().unwrap();
- components.add_security_scheme(
- "bearer_auth",
- SecurityScheme::Http(
- HttpBuilder::new()
- .scheme(HttpAuthScheme::Bearer)
- .bearer_format("JWT")
- .build()
- ),
- );
- }
- }
+ // struct SecurityAddon;
+ // impl Modify for SecurityAddon {
+ // fn modify(&self, openapi : &mut utoipa::openapi::OpenApi) {
+ // let components = openapi.components.as_mut().unwrap();
+ // components.add_security_scheme(
+ // "bearer_auth",
+ // SecurityScheme::Http(
+ // HttpBuilder::new()
+ // .scheme(HttpAuthScheme::Bearer)
+ // .bearer_format("JWT")
+ // .build()
+ // ),
+ // );
+ // }
+ // }
- let openapi = ApiDoc::openapi();
+ // let openapi = ApiDoc::openapi();
/* main server setup */
HttpServer::new(move || {
App::new()
.app_data(web::Data::new(app_state.clone()))
.route("/", web::get().to(root))
- .service(SwaggerUi::new("/docs/{_:.*}").url(
- "/docs/openapi.json",
- openapi.clone(),
- ))
+ // .service(SwaggerUi::new("/docs/{_:.*}").url(
+ // "/docs/openapi.json",
+ // openapi.clone(),
+ // ))
.service(api::api_scope())
.service(auth::auth_scope())
})