Gil
Gil

Reputation: 11

How can I access PAR request from KeyCloak custom authenticator code?

I'm using KeyCloak with a custom authenticator written in Java KeyCloak package version is 22.0.1 If a user posts an auth request to the PAR endpoint (https://KC_URL/realms/users/protocol/openid-connect/ext/par/request), how can I access the request from the custom authentication code? specifically from public void authenticate(AuthenticationFlowContext context), but if it's available in a different method I can adjust.

I tried looking for the request details in the AuthenticationFlowContext but could not find it. I'm not sure how and where the PAR request should be available from.

Upvotes: 0

Views: 175

Answers (1)

Gil
Gil

Reputation: 11

I actually ended up finding the way to get the request params, from this discussion. The way to get the request params from the PAR request in the authenticate method is using context.getAuthenticationSession().getClientNotes().get("client_request_param_application_id") for a claim called application_id passed in the request, and similarly for other claims using client_request_param_claim_name

Upvotes: 1

Related Questions