mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 04:37:00 +00:00
feat: Implement oauth token revocation
This commit is contained in:
5 files changed
+63
-16
No files matched your search
@@ -4,27 +4,29 @@ mod token;
|
||||
|
||||
use axum::{
|
||||
Json, Router,
|
||||
extract::State,
|
||||
routing::method_routing::{get, post},
|
||||
};
|
||||
use serde_json::json;
|
||||
pub(crate) use server_metadata::*;
|
||||
|
||||
const BASE_PATH: &str = "/_continuwuity/oauth2/";
|
||||
const BASE_PATH: &str = const_str::concat!(conduwuit_core::ROUTE_PREFIX, "/oauth2/");
|
||||
|
||||
pub(crate) fn router() -> Router<crate::State> {
|
||||
Router::new().nest(BASE_PATH, oauth_router())
|
||||
// TODO(unspecced): used by old versions of the matrix-js-sdk
|
||||
// .route("/.well-known/openid-configuration", get(
|
||||
// async |State(services): State<crate::State>| {
|
||||
// Json(authorization_server_metadata(&services).await)
|
||||
// }
|
||||
// ))
|
||||
.route("/.well-known/openid-configuration", get(
|
||||
async |State(services): State<crate::State>| {
|
||||
Json(authorization_server_metadata(&services).await)
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
fn oauth_router() -> Router<crate::State> {
|
||||
Router::new()
|
||||
.route("/client/register", post(register_client::register_client_route))
|
||||
.route(CLIENT_REGISTER_PATH, post(register_client::register_client_route))
|
||||
// TODO(unspecced): used by old versions of the matrix-js-sdk
|
||||
.route("/client/keys.json", get(async || Json(json!({"keys": []}))))
|
||||
.route("/grant/token", post(token::token_route))
|
||||
.route(JWKS_URI_PATH, get(async || Json(json!({"keys": []}))))
|
||||
.route(TOKEN_PATH, post(token::token_route))
|
||||
.route(TOKEN_REVOKE_PATH, post(token::revoke_token_route))
|
||||
}
|
||||
Reference in new issue
Block a user