Skip to content

Commit

Permalink
Merge pull request #21448 from sberyozkin/oidc_client_password_grant_…
Browse files Browse the repository at this point in the history
…options

Support extra params for OidcClient password grant
  • Loading branch information
sberyozkin authored Nov 15, 2021
2 parents 1a4f8e1 + da14960 commit 82be447
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ public OidcClient apply(String tokenRequestUri, Throwable t) {
grantOptions.get(OidcConstants.PASSWORD_GRANT_USERNAME));
tokenGrantParams.add(OidcConstants.PASSWORD_GRANT_PASSWORD,
grantOptions.get(OidcConstants.PASSWORD_GRANT_PASSWORD));
for (Map.Entry<String, String> entry : grantOptions.entrySet()) {
if (!OidcConstants.PASSWORD_GRANT_USERNAME.equals(entry.getKey())
&& !OidcConstants.PASSWORD_GRANT_PASSWORD.equals(entry.getKey())) {
tokenGrantParams.add(entry.getKey(), entry.getValue());
}
}
} else {
tokenGrantParams.addAll(grantOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ quarkus.oidc-client.non-standard-response.grant.refresh-token-property=refreshTo
quarkus.oidc-client.non-standard-response.grant.expires-in-property=expiresIn
quarkus.oidc-client.non-standard-response.grant-options.password.username=alice
quarkus.oidc-client.non-standard-response.grant-options.password.password=alice
quarkus.oidc-client.non-standard-response.grant-options.password.extra_param=extra_param_value
quarkus.oidc-client.non-standard-response.headers.X-Custom=XCustomHeaderValue

quarkus.oidc-client.non-standard-response-without-header.auth-server-url=${keycloak.url}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Map<String, String> start() {
"{\"access_token\":\"access_token_1\", \"expires_in\":4, \"refresh_token\":\"refresh_token_1\"}")));
server.stubFor(WireMock.post("/non-standard-tokens")
.withHeader("X-Custom", matching("XCustomHeaderValue"))
.withRequestBody(matching("grant_type=password&username=alice&password=alice"))
.withRequestBody(matching("grant_type=password&username=alice&password=alice&extra_param=extra_param_value"))
.willReturn(WireMock
.aResponse()
.withHeader("Content-Type", MediaType.APPLICATION_JSON)
Expand Down

0 comments on commit 82be447

Please sign in to comment.