[keycloak-user] How to create the same client (same id) for multiple realms programmatically
Marko Strukelj
mstrukel at redhat.com
Thu May 26 09:20:53 EDT 2016
The 'realm' variable represents a RealmResource which is locked to a
specific realm.
If you want to work with another realm you have to get a RealmResource for
that realm.
For example:
Keycloak adminClient = Keycloak.getInstance("http://localhost:8080/auth",
MASTER, ADMIN, ADMIN, Constants.ADMIN_CLI_CLIENT_ID);
RealmResource realm = adminClient.realms().get("MyRealm");
On Thu, May 26, 2016 at 2:54 PM, Haim Vana <haimv at perfectomobile.com> wrote:
> Any idea regarding the below ?
>
>
>
> As a workaround how can I update existing client programmatically ? I
> couldn't find it in the admin API.
>
>
>
>
>
> Thanks again,
>
> Haim.
>
>
>
> *From:* Haim Vana
> *Sent:* Thursday, May 26, 2016 2:17 PM
> *To:* keycloak-user at lists.jboss.org
> *Subject:* How to create the same client (same id) for multiple realms
> programmatically
>
>
>
> Hi,
>
>
>
> I am trying to create the same client for many realms, however it creates
> it only once, probably because they have the same id, however in UI I am
> able to create it.
>
>
>
> Any idea how I can create the same client for different realms
> programmatically with the same id ?
>
>
>
> This is my code sample:
>
> ClientRepresentation clientRepresentation = *new *ClientRepresentation();
> clientRepresentation.setId(clientId); // Same clientId for all reamls
>
> realm.clients().create(clientRepresentation); // Client is created only
> for first realm
>
>
>
>
>
> Any advice will be appreciated,
>
> Haim.
> The information contained in this message is proprietary to the sender,
> protected from disclosure, and may be privileged. The information is
> intended to be conveyed only to the designated recipient(s) of the message.
> If the reader of this message is not the intended recipient, you are hereby
> notified that any dissemination, use, distribution or copying of this
> communication is strictly prohibited and may be unlawful. If you have
> received this communication in error, please notify us immediately by
> replying to the message and deleting it from your computer. Thank you.
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160526/d7c6c42b/attachment-0001.html
More information about the keycloak-user
mailing list