diff options
| author | mrw1593 <botahamec@outlook.com> | 2023-05-29 17:06:44 -0400 |
|---|---|---|
| committer | mrw1593 <botahamec@outlook.com> | 2023-05-29 17:06:44 -0400 |
| commit | 4782cd0c9f1b930f05fe24118001a4de45893b79 (patch) | |
| tree | f348ae4ca022e609e286c6260c24f636f5a5cb1d /src/api/oauth.rs | |
| parent | 8ee2802e8e1b3c443485dce002115389f2ba8f75 (diff) | |
Add basic authorization to the token endpoint
Diffstat (limited to 'src/api/oauth.rs')
| -rw-r--r-- | src/api/oauth.rs | 9 |
1 files changed, 7 insertions, 2 deletions
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<MySqlPool>, query: web::Query<AuthorizationParameters>, credentials: web::Form<AuthorizeCredentials>, ) -> HttpResponse { @@ -69,7 +70,11 @@ struct TokenRequest { } #[post("/token")] -async fn token(db: web::Data<MySqlPool>, req: web::Form<TokenRequest>) -> HttpResponse { +async fn token( + db: web::Data<MySqlPool>, + req: web::Form<TokenRequest>, + authorization: web::Header<authorization::BasicAuthorization>, // TODO make this optional +) -> HttpResponse { todo!() } |
