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

'Resource not found' for standalone running #103

Open mleegwt opened 3 years ago

mleegwt commented 3 years ago

When starting the standalone version I expected to be able to access the realms and other URIs.

Startup shows the following logging (including accessing a realm):

$ java -jar standalone-0.10.0.jar
[main] INFO com.tngtech.keycloakmock.standalone.Main - Server is running on http://localhost:8000
[vert.x-eventloop-thread-0] INFO com.tngtech.keycloakmock.impl.handler.CommonHandler - 404: GET /auth/realms/master

Is my expectation correct to be able to access these URLs? Or is this a bug?

ostrya commented 3 years ago

At the moment, only the bare minimum endpoints are implemented to make OpenID Connect work. Stuff like /auth/realms/master is just not implemented, so you'll get a 404.

ostrya commented 2 years ago

Do you need this endpoint? It does not seem to be part of the OpenID spec but a Keycloak-specific endpoint. Also, I did not find any documentation of this feature in the Keycloak documentation.

mleegwt commented 2 years ago

The validation that already exists in my application uses the information to check validity of the KeyCloak instance. So I would prefer to include this. The Keycloak documentation is https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_realmrepresentation and https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_realms_admin_resource I think. Many fields are optional. Currently in use: Public key and realm. Both to allow checking validity of the token.

ostrya commented 2 years ago

I think the standard way would be to use the /auth/realms/master/.well-known/openid-configuration to discover the URL to the public key, and the realm name is already part of the URL. But we can put this on the queue with low prio.