[prev in list] [next in list] [prev in thread] [next in thread] 

List:       keycloak-dev
Subject:    [keycloak-dev] Dynamically add new users/roles
From:       mposolda () redhat ! com (Marek Posolda)
Date:       2014-06-17 7:17:52
Message-ID: 539FEBA0.6090409 () redhat ! com
[Download RAW message or body]

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/aut \
h-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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic