Skip to content

Commit

Permalink
Review comments incorporated.
Browse files Browse the repository at this point in the history
  • Loading branch information
azilentech committed Mar 15, 2022
1 parent eb60718 commit 7cea982
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions apisix/plugins/authz-keycloak.lua
Original file line number Diff line number Diff line change
Expand Up @@ -775,11 +775,10 @@ local function generate_token_using_password_grant(conf,ctx)
end

function _M.access(conf, ctx)

if conf.password_grant_token_generation_incoming_uri and
ngx.var.request_uri:upper() ==
conf.password_grant_token_generation_incoming_uri:upper() and
ctx.curr_req_matched["_method"]:upper() == "POST" then
core.request.get_method() == "POST" then
return generate_token_using_password_grant(conf,ctx)
end
log.debug("hit keycloak-auth access")
Expand Down
6 changes: 3 additions & 3 deletions docs/en/latest/plugins/authz-keycloak.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ in the `permissions` attribute, even if they contain one or more scopes already.

### Password Grant Token Generation Incoming URI

If you want to generate a token using `password` grant, you can set value of `password_grant_token_generation_incoming_uri`.
If you want to generate a token using `password` grant, you can set the value of `password_grant_token_generation_incoming_uri`.

Incoming request URI will be matched with this value and if matched, it will generate token using `Token Endpoint`.
It will also check, if REST method is `POST`.
Incoming request URI will be matched with this value and if matched, it will generate a token using `Token Endpoint`.
It will also check if the request method is `POST`.

You need to pass `application/x-www-form-urlencoded` as `Content-Type` header and `username`, `password` as parameters.

Expand Down

0 comments on commit 7cea982

Please sign in to comment.