summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/api/clients.rs2
-rw-r--r--src/api/oauth.rs19
-rw-r--r--src/api/users.rs2
3 files changed, 20 insertions, 3 deletions
diff --git a/src/api/clients.rs b/src/api/clients.rs
index 7e8ca35..44504eb 100644
--- a/src/api/clients.rs
+++ b/src/api/clients.rs
@@ -95,7 +95,7 @@ async fn get_client_redirect_uris(
Ok(HttpResponse::Ok().json(redirect_uris))
}
-#[derive(Debug, Clone, Deserialize)]
+#[derive(Clone, Deserialize)]
struct ClientRequest {
alias: Box<str>,
ty: ClientType,
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)
}
diff --git a/src/api/users.rs b/src/api/users.rs
index 2cd70c0..391a059 100644
--- a/src/api/users.rs
+++ b/src/api/users.rs
@@ -115,7 +115,7 @@ async fn get_username(
}
/// A request to create or update user information
-#[derive(Debug, Clone, Deserialize)]
+#[derive(Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
struct UserRequest {
username: Box<str>,