From 4782cd0c9f1b930f05fe24118001a4de45893b79 Mon Sep 17 00:00:00 2001 From: mrw1593 Date: Mon, 29 May 2023 17:06:44 -0400 Subject: Add basic authorization to the token endpoint --- src/api/oauth.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/api') diff --git a/src/api/oauth.rs b/src/api/oauth.rs index 7941735..a563ac8 100644 --- a/src/api/oauth.rs +++ b/src/api/oauth.rs @@ -9,7 +9,7 @@ use url::Url; use uuid::Uuid; use crate::resources::{languages, templates}; -use crate::services::db; +use crate::services::{authorization, db}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] @@ -35,6 +35,7 @@ struct AuthorizeCredentials { #[post("/authorize")] async fn authorize( + db: web::Data, query: web::Query, credentials: web::Form, ) -> HttpResponse { @@ -69,7 +70,11 @@ struct TokenRequest { } #[post("/token")] -async fn token(db: web::Data, req: web::Form) -> HttpResponse { +async fn token( + db: web::Data, + req: web::Form, + authorization: web::Header, // TODO make this optional +) -> HttpResponse { todo!() } -- cgit v1.2.3