Repository navigation
Replies: 7 comments 14 replies
|
To keep the promise of the method signature, attributes should be stored so that order is kept and duplicates are allowed. This means adding the guaranteed ordering. This makes it easier for consumers of the attributes. They don't have to sort to get stable lists. Receivers of a String representation (e.g. comma separated) could more easily detect that the values are unchanged. |
|
There's been a question on keycloak-dev regarding multiple identical values, invited the person to join the discussion: https://groups.google.com/g/keycloak-dev/c/Vmr0x6_5cHE/m/-_F2X8V0AwAJ |
|
I contacted you through the keycloak-dev mailing list to report a potential bug. As invited by @ahus1 to report my case, this is how we were using attributes... We are managing certified digital identities and each user is tagged with an attribute "rights" telling which user identity has been approved or not. In the browser login flow, we have a specific authenticator which checks if the "rights" attribute is valid for a type of right. |
|
So far it seems that there are no real-world examples of the use of an ordered list in the attributes, and also no use case for a bag (a.k.a. multiset). Given the confusion around the public interface UserModel {
// [...]
void setAttribute(String name, Collection<String> values);
Set<String> getAttribute(String name);
Map<String, Set<String>> getAttributes();
// [...]This discussion is still open for the moment. If you object this change, please speak up. |
|
From my POV, attributes don't have to be ordered in the REST API, but it makes sense to have them ordered in the UI - by attribute key. I don't know whether it is necessary that attribute values are ordered. There is an issue regarding ordering by attribute key in a slightly different, but similar context: realm localization texts. See #9418 |
|
I also don't see a reason to maintain an explicit order for attribute values. However I want to point out that changing the signature of How about leaving the attributes as is and create a new dedicated abstraction for storing user provided meta-data? |
Uh oh!
There was an error while loading. Please reload this page.
Keycloak currently supports multi-valued attributes for groups, roles and users. The interfaces describes following signature:
Key of the map is attribute name and value of the map should be list of the attribute values.
Looking at current jpa implementation, e.g.
RoleEntity. It contains list of attributes but no order column. Therefore the order of attribute values is not guarantied and it means the bag data-type is used. It seems it should be the preferred way when duplicates are allowed.There are couple options how we should handle attributes in new store and I'd like to know what are use-cases of it in current deployments.
Is there any deployments what'd require
All reactions