Based on my investigtaion there are 2 things:
PrimaryGroupId
from User sidePrimaryGroupToken
operational attribute from Group side
User references to group PrimaryGroupToken
operational attribute using field PrimaryGroupId
There are 2 ways to to get PrimaryGroupToken
- Based on primaryGroupToken operation attribute
val entry = ldapConnectionPool.getEntry(groupDn, "*", "primaryGroupToken")
val primaryGroupToken = entry.getAttributeValue("PrimaryGroupToken")
- Based on
objectSid
suffix
val entry = ldapConnectionPool.getEntry(groupDn)
val domainSidBytes = entry.getAttributeValueBytes("objectSid")
val domainSidString = LdapUtils.convertBinarySidToString(domainSidBytes)
val primaryGroupToken = domainSidString.substringAfterLast("-")
I haven't found any direct way how I can get group entry by user primaryGroupId so I started to think about application level cache. But I expected that primaryGroupToken is a constant group identifier but this page confuses me.
https://learn.microsoft.com/en-us/windows/win32/adschema/a-primarygrouptoken
As you can see it is mentioned that this attribute could be updated. Based on my exeriments - I was not able to achieve it. Could you please clarify if this attribute is immutable or not ?