diff options
| author | mrw1593 <botahamec@outlook.com> | 2023-05-29 16:15:33 -0400 |
|---|---|---|
| committer | mrw1593 <botahamec@outlook.com> | 2023-05-29 16:15:33 -0400 |
| commit | 8ee2802e8e1b3c443485dce002115389f2ba8f75 (patch) | |
| tree | f8182792c54af37b8058968726fffc18fd477581 /src/api/oauth.rs | |
| parent | 747b7e6d399dc70c15262348ec763037c77f2013 (diff) | |
Stub out a token endpoint
Diffstat (limited to 'src/api/oauth.rs')
| -rw-r--r-- | src/api/oauth.rs | 19 |
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) } |
