summaryrefslogtreecommitdiff
path: root/src/api/oauth.rs
diff options
context:
space:
mode:
authormrw1593 <botahamec@outlook.com>2023-05-29 16:15:33 -0400
committermrw1593 <botahamec@outlook.com>2023-05-29 16:15:33 -0400
commit8ee2802e8e1b3c443485dce002115389f2ba8f75 (patch)
treef8182792c54af37b8058968726fffc18fd477581 /src/api/oauth.rs
parent747b7e6d399dc70c15262348ec763037c77f2013 (diff)
Stub out a token endpoint
Diffstat (limited to 'src/api/oauth.rs')
-rw-r--r--src/api/oauth.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/api/oauth.rs b/src/api/oauth.rs
index c6504e1..7941735 100644
--- a/src/api/oauth.rs
+++ b/src/api/oauth.rs
@@ -27,7 +27,7 @@ pub struct AuthorizationParameters {
state: Option<Box<str>>,
}
-#[derive(Debug, Clone, Deserialize)]
+#[derive(Clone, Deserialize)]
struct AuthorizeCredentials {
username: Box<str>,
password: Box<str>,
@@ -57,8 +57,25 @@ async fn authorize_page(
HttpResponse::Ok().content_type("text/html").body(page)
}
+#[derive(Clone, Deserialize)]
+#[serde(tag = "grant_type")]
+enum GrantType {}
+
+#[derive(Clone, Deserialize)]
+struct TokenRequest {
+ #[serde(flatten)]
+ grant_type: GrantType,
+ scope: String, // TODO lol no
+}
+
+#[post("/token")]
+async fn token(db: web::Data<MySqlPool>, req: web::Form<TokenRequest>) -> HttpResponse {
+ todo!()
+}
+
pub fn service() -> Scope {
web::scope("/oauth")
.service(authorize_page)
.service(authorize)
+ .service(token)
}