[keycloak-user] How to configure a user Federation SPI implementation
Bill Burke
bburke at redhat.com
Mon Aug 1 15:08:05 EDT 2016
"userFederation" : { "IDP-API" : { "test": "value } }
On 8/1/16 2:56 PM, Zhaohua Meng wrote:
>
> Marek,
>
> My implementation id is “IDP-API” and my getId() and init() method are
> following:
>
> @Override
>
> *public*String getId() {
>
> *return*("IDP-API");
>
> }
>
> @Override
>
> *public**void*init(Scope config) {
>
> logger.info("in init");
>
> this.config = config;
>
> logger.infof("config: %s",config.get("test"));
>
> }
>
> I’m getting null for the config.get("test"). What am I doing wrong here?
>
> I’m copying the keycloak-server.json in my test for your reference.
>
> {
>
> "IDP-API": {
>
> "test": "_idp_ _api_ test value"
>
> },
>
> "providers": [
>
> "_classpath_:${jboss.home.dir}/providers/*"
>
> ],
>
> "_admin_": {
>
> "realm": "master"
>
> },
>
> "eventsStore": {
>
> "provider": "_jpa_",
>
> "_jpa_": {
>
> "exclude-events": [ "REFRESH_TOKEN" ]
>
> }
>
> },
>
> "realm": {
>
> "provider": "_jpa_"
>
> },
>
> "user": {
>
> "provider": "_jpa_"
>
> },
>
> "userCache": {
>
> "default" : {
>
> "enabled": true
>
> }
>
> },
>
> "userSessionPersister": {
>
> "provider": "_jpa_"
>
> },
>
> "authorizationPersister": {
>
> "provider": "_jpa_"
>
> },
>
> "timer": {
>
> "provider": "basic"
>
> },
>
> "theme": {
>
> "staticMaxAge": 2592000,
>
> "cacheTemplates": true,
>
> "cacheThemes": true,
>
> "folder": {
>
> "_dir_": "${jboss.home.dir}/themes"
>
> }
>
> },
>
> "scheduled": {
>
> "interval": 900
>
> },
>
> "connectionsHttpClient": {
>
> "default": {}
>
> },
>
> "connectionsJpa": {
>
> "default": {
>
> "dataSource": "java:jboss/_datasources_/KeycloakDS",
>
> "databaseSchema": "update"
>
> }
>
> },
>
> "realmCache": {
>
> "default" : {
>
> "enabled": true
>
> }
>
> },
>
> "connectionsInfinispan": {
>
> "provider": "default",
>
> "default": {
>
> "cacheContainer" : "java:comp/_env_/_infinispan_/_Keycloak_"
>
> }
>
> }
>
> }
>
> Thanks,
>
> --
>
> Zhaohua Meng
>
> Business Intelligence, AppNexus
>
> 973-936-8028 (cell)
>
> 973-415-8028 (home)
>
> *From: *Marek Posolda <mposolda at redhat.com>
> *Date: *Monday, August 1, 2016 at 1:32 PM
> *To: *Zaohua <zmeng at appnexus.com>, "keycloak-user at lists.jboss.org"
> <keycloak-user at lists.jboss.org>
> *Subject: *Re: [keycloak-user] How to configure a user Federation SPI
> implementation
>
> In YourUserFederationProviderFactory.init you can read the properties,
> which you configured in the keycloak-server.json. It's used in the
> event example for instance. For UserFederation it works the same way :
> https://github.com/keycloak/keycloak/blob/master/examples/providers/event-store-mem/src/main/java/org/keycloak/examples/providers/events/MemEventStoreProviderFactory.java#L56
>
>
> Note that YourUserFederationProviderFactory.getId is corresponding to
> the providerId used in keycloak-server.json .
>
> Btv. the YourUserFederationProviderFactory.getConfigurationOptions()
> you can return list of strings, which will be used as names of the
> properties configurable in admin console. This is an alternative to
> keycloak-server.json configuration. See the userFederation example for
> more details.
>
> Marek
>
> On 01/08/16 19:23, Zhaohua Meng wrote:
>
> I wrote a user federation SPI implementation to integrate our
> internal user management. Particularly, an implementation of
> org.keycloak.models.UserFederationProviderFactory and
> org.keycloak.models.UserFederationProvider.
>
> My question is, how do you configure it in the keycloak-server.json?
>
> The documentation gave example for event listener but not user
> federation. Following the doc with similar approach I tried “{
> “userFederation”: { “my-impl”: { “myProperty”:””, ...} …}}”, and
> all kinds of combinations like that but nothing worked. I’d really
> appreciate if you can share some experience here.
>
> I’m quoting the doc in this regard here:
> https://keycloak.gitbooks.io/server-developer-guide/content/v/2.0/topics/providers.html#providers
>
> ...…
>
> Configuring a provider
>
> You can pass configuration options to your provider by setting
> them in keycloak-server.json. For example to set the max value for
> my-event-listener add:
>
> {
>
> "eventsListener": {
>
> "my-event-listener": {
>
> "max": 100
>
> }
>
> }
>
> }
>
> …..
>
> Thanks,
>
> --
>
> Zhaohua Meng
>
> Business Intelligence, AppNexus
>
> 973-936-8028 (cell)
>
> 973-415-8028 (home)
>
>
>
>
> _______________________________________________
>
> keycloak-user mailing list
>
> keycloak-user at lists.jboss.org <mailto:keycloak-user at lists.jboss.org>
>
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
>
>
> _______________________________________________
> 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/20160801/594fe642/attachment-0001.html
More information about the keycloak-user
mailing list