[keycloak-dev] Are both "id" and "name" needed on RealmModel?
Marek Posolda
mposolda at redhat.com
Fri Sep 6 17:59:40 EDT 2013
Actually in RealmModel there are methods:
String getId();
String getName();
void setName(String name);
and in KeycloakSession there are methods:
RealmModel createRealm(String name);
RealmModel createRealm(String id, String name);
RealmModel getRealm(String id);
There is also quite strange mapping as model attribute "id" is mapped in
Picketlink partition as "name" and model attribute "name" is mapped in
Picketlink as "realmName" (I used something similar for my MongoDB
prototype as well).
I wonder if it's really needed to have both "id" and "name" in model?
Picketlink allows to search Partitions by "name" (represented in
Keycloak as "id"), so I think that it should be good enough to have in
model just "name" and map it to Picketlink "name".
So I would propose to remove "id" from model and have RealmModel like:
String getName();
void setName(String name);
and KeycloakSession like:
RealmModel createRealm(String name);
RealmModel getRealm(String name);
and map "name" to Picketlink "name", which will also allow searching by it.
BTW. It seems that almost all places in Keycloak (despite few unit
tests) are always using same value for "id" and "name". For example:
RealmModel defaultRealm = manager.createRealm(RealmModel.DEFAULT_REALM,
RealmModel.DEFAULT_REALM);
So I don't know why to have this duplicity.
Marek
More information about the keycloak-dev
mailing list