[keycloak-dev] Dynamically add new users/roles
Marek Posolda
mposolda at redhat.com
Tue Jun 17 03:17:52 EDT 2014
Hi Bruno,
yes it exists. You can use our model API to add new users and/or roles.
I can see that this is already used inside your UpsSecurityApplication
https://github.com/keycloak/keycloak/blob/master/project-integrations/aerogear-ups/auth-server/src/main/java/org/aerogear/ups/security/UpsSecurityApplication.java#L25,
which is doing some modification to master realm with usage of this
model API. Note that you always need to wrap all calls to model API into
KeycloakTransaction as seen in this example.
For more reference on how to retrieve realm, and add users or roles, see
for example unit test here
https://github.com/keycloak/keycloak/blob/master/model/tests/src/test/java/org/keycloak/model/test/AdapterTest.java#L241
(for adding user) and here
https://github.com/keycloak/keycloak/blob/master/model/tests/src/test/java/org/keycloak/model/test/AdapterTest.java#L433
for adding role.
Marek
On 17.6.2014 05:34, Bruno Oliveira wrote:
> Good morning guys,
>
> Does exist any way to programatically add new users and roles with
> Keycloak?
>
>
> --
>
> abstractj
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
More information about the keycloak-dev
mailing list