TNG / keycloak-mock

A Java library to test REST endpoints secured by Keycloak via OpenID connect.
Apache License 2.0
120 stars 27 forks source link

Add support to confidential client using form based authentication #98

Closed marcelocamanho closed 2 years ago

marcelocamanho commented 3 years ago

Trying to use, for instance, a microservice that connects to Keycloak using a form based authentication does not work, only using basic auth (ref https://github.com/TNG/keycloak-mock/pull/88 and https://github.com/TNG/keycloak-mock/pull/85)

ex: POST realms/{realm}/protocol/openid-connect/token?client_id={client}&grant_type=client_credentials&client_secret={secret} Headers: "Content-Type: application/x-www-form-urlencoded", "Accept: application/json"

Fails with 401 status code, as it only accepts BASIC auth.

it does work with Keycloak / Redhat SSO

ref: https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1