diff options
-rw-r--r-- | kittybox-rs/src/indieauth/mod.rs | 60 | ||||
-rw-r--r-- | kittybox-rs/src/main.rs | 3 |
2 files changed, 39 insertions, 24 deletions
diff --git a/kittybox-rs/src/indieauth/mod.rs b/kittybox-rs/src/indieauth/mod.rs index 8100b2a..b22f3ba 100644 --- a/kittybox-rs/src/indieauth/mod.rs +++ b/kittybox-rs/src/indieauth/mod.rs @@ -389,27 +389,43 @@ pub fn router<A: AuthBackend>(backend: A) -> axum::Router { use axum::routing::{Router, get, post}; Router::new() + .nest( + "/.kittybox/indieauth", + Router::new() + .route( + "/auth", + get(authorization_endpoint_get) + .post(authorization_endpoint_post::<A>)) + .route( + "/token", + post(token_endpoint_post::<A>)) + .route( + "/token_status", + post(introspection_endpoint_post::<A>)) + .route( + "/revoke_token", + post(revocation_endpoint_post::<A>)) + .route( + "/userinfo", + get(userinfo_endpoint_get::<A>)) + .layer(tower_http::cors::CorsLayer::new() + .allow_methods([ + axum::http::Method::GET, + axum::http::Method::POST + ]) + .allow_origin(tower_http::cors::Any)) + .layer(Extension(backend)) + ) .route( - "/auth", - get(authorization_endpoint_get) - .post(authorization_endpoint_post::<A>)) - .route( - "/token", - post(token_endpoint_post::<A>)) - .route( - "/token_status", - post(introspection_endpoint_post::<A>)) - .route( - "/revoke_token", - post(revocation_endpoint_post::<A>)) - .route( - "/userinfo", - get(userinfo_endpoint_get::<A>)) - .layer(tower_http::cors::CorsLayer::new() - .allow_methods([ - axum::http::Method::GET, - axum::http::Method::POST - ]) - .allow_origin(tower_http::cors::Any)) - .layer(Extension(backend)) + "/.well-known/oauth-authorization-server", + get(|| std::future::ready( + ( + StatusCode::FOUND, + [ + ("Location", + "/.kittybox/indieauth/metadata") + ] + ).into_response() + )) + ) } diff --git a/kittybox-rs/src/main.rs b/kittybox-rs/src/main.rs index 4fb0eec..9e81aad 100644 --- a/kittybox-rs/src/main.rs +++ b/kittybox-rs/src/main.rs @@ -155,8 +155,7 @@ async fn main() { let media = axum::Router::new() .nest("/.kittybox/media", kittybox::media::router(blobstore).layer(axum::Extension(http))); - /*let indieauth = axum::Router::new() - .nest("/.kittybox/indieauth", kittybox::indieauth::router());*/ + //let indieauth = kittybox::indieauth::router(); let technical = axum::Router::new() .route( |