Forgot that attributes are not exposed through RealmModel. You can't access the JPA RealmAdapter directly as you'll break the cache functionality. You can create a JIRA to request attributes added to RealmModel though.

On 15 July 2016 at 20:28, Mitya <> wrote:

In my provider, session.getContext().getRealm() returns an instance of org.keycloak.models.cache.infinispan.RealmAdapter. But in order to be able to manage attributes, we need an org.keycloak.models.jpa.RealmAdapter. What's the best way to obtain it?

I've yet come up with the following:

RealmModel realm = session.getContext().getRealm();
RealmAdapter adapter = (RealmAdapter) session.getProvider(RealmProvider.class).getRealm(realm.getId());

Realm attributes should be perfect for that

On 12 July 2016 at 13:42, Mitya <> wrote:

I'm developing a KeyCloak extension, and I want some custom (per-realm) parameters to be tuned via the GUI form. Speaking of the storage mechanism for my settings, are realm attributes suitable for that? or should I create a dedicated custom entity instead?


keycloak-dev mailing list