<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi,<br>
<br>
<br>
On 04/11/15 19:58, Giovanni Baruzzi wrote:<br>
</div>
<blockquote cite="mid:D26013F2.1D0A2%25giovanni.baruzzi@syntlogo.de"
type="cite">
<div><span style="font-family: Helvetica; font-size: 12px;">Dear
all,</span><br style="font-family: Helvetica; font-size:
12px;">
<br style="font-family: Helvetica; font-size: 12px;">
<br style="font-family: Helvetica; font-size: 12px;">
<span style="font-family: Helvetica; font-size: 12px;">at the
moment using the LDAP Identity federation we can map a role to
the membership to a group.</span><br style="font-family:
Helvetica; font-size: 12px;">
<br style="font-family: Helvetica; font-size: 12px;">
<span style="font-family: Helvetica; font-size: 12px;">We are
using instead of the groupMembership the „menberOf“ approach,
dedicating an attribute to list the values of the roles owned
by the user.</span><br style="font-family: Helvetica;
font-size: 12px;">
</div>
</blockquote>
<br>
AFAIK memberOf is just read-only mirror of "member" attribute where
"member" is writable and it's available on the group (roles) objects
when memberOf is mirrored on users. At least it works this way on
the Active Directory and some other LDAP servers too. Or doesn't it
work on your LDAP server and you are not seeing "member" attribute
on groups?<br>
<br>
Our RoleLDAPFederationMapper implementation is using "member"
attribute approach because "member" attribute is writable and it's
sufficient to achieve to all of CRUD user role mappings operations.<br>
<br>
At this moment, the only reason when I can see the advantage of
"memberOf" is better performance in read-only LDAP servers as you
need to query just user object to receive both it's attributes and
role mappings in single step. Is this the reason why you want it or
do you have other reason? <br>
<blockquote cite="mid:D26013F2.1D0A2%25giovanni.baruzzi@syntlogo.de"
type="cite">
<div><span style="font-family: Helvetica; font-size: 12px;">How
would you suggest the implementation of this requirement?</span><br
style="font-family: Helvetica; font-size: 12px;">
<span style="font-family: Helvetica; font-size: 12px;">Can you
imagine a way to implement it using the planned customised
filter?</span><br style="font-family: Helvetica; font-size:
12px;">
<span style="font-family: Helvetica; font-size: 12px;">Should we
go for a custom federation provider?</span><br
style="font-family: Helvetica; font-size: 12px;">
</div>
</blockquote>
There are 2 steps to achieve it.<br>
<br>
1) You can use existing "User attribute" mapper to map "memberOf"
attribute to some attribute in user model. This way the "memberOf"
will be queried from LDAP and saved into Keycloak DB as part of the
user record. You can check in admin console (tab "Attributes" of
user) if the memberOf was successfully returned<br>
<br>
2) Then you may need to implement custom LDAPFederationMapper, which
will return proxy user object and you override some methods of this
proxy ( getRoleMappings , hasRole, maybe getRealmRoleMappings and
getClientRoleMappings) to return the roles based on the "memberOf"
attribute, which is available on UserModel thanks to previous step.
See existing RoleLDAPFederationMapper for inspiration.<br>
<br>
So you don't need custom federation provider, but just custom
federation mapper. <br>
<br>
I wonder if we should support "memberOf" in Keycloak OOTB. I am
curious about your reasons to use it in prefer to "member" .<br>
<br>
Marek<br>
<blockquote cite="mid:D26013F2.1D0A2%25giovanni.baruzzi@syntlogo.de"
type="cite">
<div><br style="font-family: Helvetica; font-size: 12px;">
<span style="font-family: Helvetica; font-size: 12px;">thank you
for your answers,</span><br style="font-family: Helvetica;
font-size: 12px;">
<span style="font-family: Helvetica; font-size: 12px;">Giovanni</span></div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
keycloak-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/keycloak-user">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
</blockquote>
<br>
</body>
</html>