refactor: modularize api server assets and handlers
This commit is contained in:
27
server-rs/crates/api-server/src/modules/internal.rs
Normal file
27
server-rs/crates/api-server/src/modules/internal.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use axum::{Router, middleware, routing::get};
|
||||
|
||||
use crate::{
|
||||
auth::{
|
||||
attach_refresh_session_token, inspect_auth_claims, inspect_refresh_session_cookie,
|
||||
require_bearer_auth,
|
||||
},
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
pub fn router(state: AppState) -> Router<AppState> {
|
||||
Router::new()
|
||||
.route(
|
||||
"/_internal/auth/claims",
|
||||
get(inspect_auth_claims).route_layer(middleware::from_fn_with_state(
|
||||
state.clone(),
|
||||
require_bearer_auth,
|
||||
)),
|
||||
)
|
||||
.route(
|
||||
"/_internal/auth/refresh-cookie",
|
||||
get(inspect_refresh_session_cookie).route_layer(middleware::from_fn_with_state(
|
||||
state.clone(),
|
||||
attach_refresh_session_token,
|
||||
)),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user