Hi,
I have configured an STS-chain that I'm calling from the SP side towards the end of the SAML federation.
I only want the IDP to provide me with the username, I as an SP will look into my own LDAP and fetch group membership from my STS-chain.
I used the IBM Security Access Manager Federation Cookbook as a guide for this.
And I have made it work.
After SAML login, I can see that my groups are added to the credential, but they are added like this:
AZN_CUSTOM_ATTRIBUTES : ibm-allgroups
ibm-allgroups : = cn=group1,o=blalbla,c=bla, cn=group2,o=blabla,c=bla, cn=group3,o=blabla,c=bla
This kind of formatting is not recognized in ISVA as group membership. For example, ISVA doesn't naturally include those groups inside the iv-creds.
Any tips on how I can add those groups in a more "natural" way so as they are included in the iv-creds?
My mapping rules are looking like this at the moment:
ip_pre_ldap
importPackage(Packages.com.tivoli.am.fim.trustserver.sts);
importPackage(Packages.com.tivoli.am.fim.trustserver.sts.uuser);
importPackage(Packages.com.tivoli.am.fim.trustserver.sts.utilities);
//
// we can inspect the stsuu and make and decisions we want here before populating STSUU
// that will be used as input to the LDAP Attribute mapping rule.
//
// for this demo, just set the BASE_DN to the DN we want to search for - if one isn't already set
var existingbaseDN = stsuu.getAttributeValueByName("BASE_DN");
if (existingbaseDN != null && existingbaseDN.length() > 0) {
IDMappingExtUtils.traceString("The ip_pre_ldap.js found an existing BASE_DN: " + existingbaseDN);
} else {
IDMappingExtUtils.traceString("The ip_pre_ldap.js mapping rule is setting the BASE_DN");
var baseDNAttr = new Attribute("BASE_DN", null, "uid=dummyHardwired,o=blabla,c=bla");
stsuu.addAttribute(baseDNAttr);
}
ip_post_ldap
importPackage(Packages.com.tivoli.am.fim.trustserver.sts);
importPackage(Packages.com.tivoli.am.fim.trustserver.sts.uuser);
importPackage(Packages.com.tivoli.am.fim.trustserver.sts.utilities);
//re-write Principal name with type as email nameid format
var principalName = stsuu.getPrincipalName();
stsuu.getPrincipalAttributeContainer().clear();
stsuu.addPrincipalAttribute(new Attribute("name", "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", principalName));
//
// filter out STSUU attributes that we don't want in the SAML assertion after the LDAP
// search has run. A good example of this is the BASE_DN attribute, plus other attributes
// that were in the ISAM Credential at the SAML IDP.
//
//
// The simplest way to do this is to decide which attributes we want to keep, and discard the rest.
//
var keepAttrs = [ "ibm-allgroups", "groups" ];
var foundAttrs = [];
for (var i = 0; i < keepAttrs.length; i++) {
var attr = stsuu.getAttributeContainer().getAttributeByName(keepAttrs[i]);
if (attr != null) {
foundAttrs.push(attr);
}
}
// empty attrs, then add back what we want
stsuu.clearAttributeList();
for (var i = 0; i < foundAttrs.length; i++) {
stsuu.addAttribute(foundAttrs[i]);
}
And the attribute source I have created under Federation > Attribute source
Attribute name Groups
Value ibm-allgroups
Type LDAP
And the attribute mapping I'm doing inside the STS-chain:
Attribute Name ibm-allgroups
Attribute Source Groups
------------------------------
Jonatan Wålegård
------------------------------