Search code examples
javakeycloak

Keycloak: REST url for custom endpoint


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?


Solution

  • 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