Implementing a custom rest endpoint in keycloak I used these example:
https://github.com/keycloak/keycloak/tree/master/examples/providers/domain-extension/src/main/java/org/keycloak/examples/domainextension/rest
After embedding the provider to keycloak it's loaded during keycloak startup. Guess that's fine. In server info I can see the the endpoint as well.
Problem:
How may I call that endpoint?
Do I need to registrate the endpoint or mount it on a client?
(If so which settings does the client need (admin rights etc...)
What is the URL for calling the endpoint?
To use these endpoints with Postman, we'll start by creating an Environment called “Keycloak.” Then we'll add some key/value entries for the Keycloak authorization server URL, the realm, OAuth 2.0 client id, and client password: Finally, we'll create a collection where we can organize our Keycloak tests.
Navigate to the Postman Authorization tab of your request. From the Type dropdown menu, select OAuth 2.0: Click on the Get New Access Token button that will open a dialog box for configuring the identity server (Keycloak in our case).
Keycloak comes with a fully functional Admin REST API with all features provided by the Admin Console. To invoke the API you need to obtain an access token with the appropriate permissions.
Your don't need register or mount your endpoint. the effective url is calculated with the given id in your ProviderFactory.
{{keycloakUrl}}/auth/realms/{{reamlName}}/{{id in providerFactory}}/...
For your example the url is
{{keycloakUrl}}/auth/realms/{{realmName}}/example/companies
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With