Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycloak: REST url for custom endpoint

Tags:

java

keycloak

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?

like image 206
pDer666 Avatar asked Feb 27 '19 07:02

pDer666


People also ask

How do I get Keycloak endpoints?

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.

How do you get a Keycloak access token?

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).

Does Keycloak have an API?

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.


1 Answers

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
like image 161
Patrick Hesse Avatar answered Oct 22 '22 07:10

Patrick Hesse