Skip to main content

systemprompt_api/routes/oauth/endpoints/authorize/
mod.rs

1//! OAuth 2.0 authorization endpoint.
2//!
3//! Hosts the GET/POST `/authorize` handlers and the request types
4//! [`AuthorizeQuery`] and [`AuthorizeRequest`] they bind. The flow validates
5//! the inbound request ([`validation`]), then renders the `WebAuthn` challenge
6//! page ([`response_builder`]) rather than supporting password auth.
7//!
8//! Copyright (c) systemprompt.io — Business Source License 1.1.
9//! See <https://systemprompt.io> for licensing details.
10
11mod handler;
12pub mod response_builder;
13pub mod validation;
14
15pub use handler::{handle_authorize_get, handle_authorize_post};
16
17use serde::Deserialize;
18use systemprompt_identifiers::ClientId;
19
20#[derive(Debug, Clone, Deserialize)]
21pub struct AuthorizeQuery {
22    pub response_type: String,
23    pub client_id: ClientId,
24    pub redirect_uri: Option<String>,
25    pub scope: Option<String>,
26    pub state: Option<String>,
27    pub code_challenge: Option<String>,
28    pub code_challenge_method: Option<String>,
29    pub response_mode: Option<String>,
30    pub display: Option<String>,
31    pub prompt: Option<String>,
32    pub max_age: Option<i64>,
33    pub ui_locales: Option<String>,
34    pub resource: Option<String>,
35}
36
37#[derive(Debug, Deserialize)]
38pub struct AuthorizeRequest {
39    pub response_type: String,
40    pub client_id: ClientId,
41    pub redirect_uri: Option<String>,
42    pub scope: Option<String>,
43    pub state: Option<String>,
44    pub code_challenge: Option<String>,
45    pub code_challenge_method: Option<String>,
46    pub user_consent: Option<String>,
47    pub username: Option<String>,
48    pub password: Option<String>,
49    pub resource: Option<String>,
50}