headless_lms_server/controllers/main_frontend/oauth/mod.rs
1use actix_web::web::ServiceConfig;
2use utoipa::OpenApi;
3
4/// OAuth 2.0 and OpenID Connect implementation.
5///
6/// This module implements the following RFCs and specifications:
7///
8/// ## OAuth 2.0 Core
9/// - [RFC 6749 — OAuth 2.0 Authorization Framework](https://datatracker.ietf.org/doc/html/rfc6749)
10/// - §3.1 — Authorization Endpoint (`/authorize`)
11/// - §3.2 — Token Endpoint (`/token`)
12///
13/// ## OAuth 2.0 Extensions
14/// - [RFC 7009 — OAuth 2.0 Token Revocation](https://datatracker.ietf.org/doc/html/rfc7009) (`/revoke`)
15/// - [RFC 7636 — Proof Key for Code Exchange (PKCE)](https://datatracker.ietf.org/doc/html/rfc7636)
16/// - [RFC 7662 — OAuth 2.0 Token Introspection](https://datatracker.ietf.org/doc/html/rfc7662) (`/introspect`)
17/// - [RFC 8414 — OAuth 2.0 Authorization Server Metadata](https://www.rfc-editor.org/rfc/rfc8414) (`/.well-known/openid-configuration`)
18/// - [RFC 9449 — OAuth 2.0 Demonstrating Proof-of-Possession (DPoP)](https://datatracker.ietf.org/doc/html/rfc9449)
19///
20/// ## JSON Web Token (JWT)
21/// - [RFC 7517 — JSON Web Key (JWK)](https://datatracker.ietf.org/doc/html/rfc7517) (`/jwks.json`)
22///
23/// ## OpenID Connect
24/// - [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html)
25/// - §3 — Authorization Endpoint (`/authorize`)
26/// - §3.1.3 — Token Endpoint (`/token`)
27/// - §5.3 — UserInfo Endpoint (`/userinfo`)
28/// - §10 — JWKS endpoint for key discovery (`/jwks.json`) — Note: Currently exposes a single key; key rotation not implemented
29/// - [OpenID Connect Discovery 1.0](https://openid.net/specs/openid-connect-discovery-1_0.html) (`/.well-known/openid-configuration`)
30mod authorize;
31mod authorized_clients;
32mod consent;
33mod device;
34mod discovery;
35mod introspect;
36mod revoke;
37mod token;
38mod userinfo;
39
40#[derive(OpenApi)]
41#[openapi(paths(
42 discovery::jwks,
43 discovery::well_known_openid,
44 authorize::authorize_get_doc,
45 authorize::authorize_post_doc,
46 token::token,
47 userinfo::user_info_get_doc,
48 userinfo::user_info_post_doc,
49 revoke::revoke,
50 consent::approve_consent,
51 consent::deny_consent,
52 device::device_authorization,
53 device::device_verification,
54 device::approve_device_verification,
55 device::deny_device_verification,
56 authorized_clients::get_authorized_clients,
57 authorized_clients::delete_authorized_client,
58 introspect::introspect
59))]
60pub(crate) struct MainFrontendOauthApiDoc;
61
62pub fn _add_routes(cfg: &mut ServiceConfig) {
63 authorize::_add_routes(cfg);
64 token::_add_routes(cfg);
65 userinfo::_add_routes(cfg);
66 discovery::_add_routes(cfg);
67 revoke::_add_routes(cfg);
68 consent::_add_routes(cfg);
69 device::_add_routes(cfg);
70 authorized_clients::_add_routes(cfg);
71 introspect::_add_routes(cfg);
72}