Skip to content

Commit

Permalink
feat: rename introspection endpoint to comply with spec
Browse files Browse the repository at this point in the history
  • Loading branch information
tronghn committed Nov 2, 2024
1 parent 39f88bb commit 0d4f9ba
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hack/roundtrip-azure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ user_token=$(echo ${user_token_response} | jq -r .access_token)
response=$(curl -s -X POST http://localhost:3000/token -H "content-type: application/json" -d '{"target": "my-target", "identity_provider": "azuread", "user_token": "'${user_token}'"}')
token=$(echo ${response} | jq -r .access_token)

#validation=$(curl -s -X POST http://localhost:3000/introspection -H "content-type: application/json" -d "{\"token\": \"${token}\"}")
#validation=$(curl -s -X POST http://localhost:3000/introspect -H "content-type: application/json" -d "{\"token\": \"${token}\"}")

echo
echo "JWT:"
Expand Down
2 changes: 1 addition & 1 deletion hack/roundtrip.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -e
response=$(curl -s -X POST http://localhost:3000/token -H "content-type: application/json" -d '{"target": "my-target", "identity_provider": "maskinporten"}')
token=$(echo ${response} | jq -r .access_token)
validation=$(curl -s -X POST http://localhost:3000/introspection -H "content-type: application/json" -d "{\"token\": \"${token}\"}")
validation=$(curl -s -X POST http://localhost:3000/introspect -H "content-type: application/json" -d "{\"token\": \"${token}\"}")

echo
echo "JWT:"
Expand Down
2 changes: 1 addition & 1 deletion src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub async fn token(
Ok((StatusCode::OK, Json(res)))
}

pub async fn introspection(
pub async fn introspect(
State(state): State<HandlerState>,
Json(request): Json<IntrospectRequest>,
) -> Result<impl IntoResponse, ApiError> {
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ async fn main() {
};

let app = Router::new()
.route("/token", post(handlers::token))
.with_state(state.clone())
.route("/token", post(handlers::token))
.route(
"/introspection",
post(handlers::introspection).with_state(state.clone()),
"/introspect",
post(handlers::introspect),
);

let listener = tokio::net::TcpListener::bind(cfg.bind_address)
Expand Down

0 comments on commit 0d4f9ba

Please sign in to comment.