[keycloak-user] How to configure a user Federation SPI implementation
Zhaohua Meng
zmeng at appnexus.com
Mon Aug 1 15:18:24 EDT 2016
Marek,
It worked for me.
Thank you very much!
--
Zhaohua Meng
Business Intelligence, AppNexus
From: <keycloak-user-bounces at lists.jboss.org> on behalf of Bill Burke <bburke at redhat.com>
Date: Monday, August 1, 2016 at 3:08 PM
To: "keycloak-user at lists.jboss.org" <keycloak-user at lists.jboss.org>
Subject: Re: [keycloak-user] How to configure a user Federation SPI implementation
"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
From: Marek Posolda <mposolda at redhat.com><mailto:mposolda at redhat.com>
Date: Monday, August 1, 2016 at 1:32 PM
To: Zaohua <zmeng at appnexus.com><mailto:zmeng at appnexus.com>, "keycloak-user at lists.jboss.org"<mailto:keycloak-user at lists.jboss.org> <keycloak-user at lists.jboss.org><mailto: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
_______________________________________________
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<mailto: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/166598ce/attachment-0001.html
More information about the keycloak-user
mailing list