summaryrefslogtreecommitdiff
path: root/src/api/oauth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/oauth.rs')
-rw-r--r--src/api/oauth.rs9
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!()
}