use of com.sun.identity.common.CaseInsensitiveHashSet in project OpenAM by OpenRock.
the class OpenSSOSubjectAttributesCollector method getAvailableSubjectAttributeNames.
public Set<String> getAvailableSubjectAttributeNames() throws EntitlementException {
CaseInsensitiveHashSet result = new CaseInsensitiveHashSet();
try {
ServiceConfig sc = idRepoServiceConfigManager.getOrganizationConfig(realm, null);
if (sc != null) {
Set<String> subConfigNames = sc.getSubConfigNames();
if (subConfigNames != null) {
for (String idRepoName : subConfigNames) {
ServiceConfig reposc = sc.getSubConfig(idRepoName);
Map<String, Set<String>> attrMap = reposc.getAttributesForRead();
Set<String> userAttrs = attrMap.get(LDAPv3Config_USER_ATTR);
if ((userAttrs != null) && !userAttrs.isEmpty()) {
result.addAll(userAttrs);
}
}
}
}
return result;
} catch (SMSException e) {
throw new EntitlementException(602, e);
} catch (SSOException e) {
throw new EntitlementException(602, e);
}
}
use of com.sun.identity.common.CaseInsensitiveHashSet in project OpenAM by OpenRock.
the class ConfigureSocialAuthN method mergeAttributes.
/**
* Carefully merge the values in two maps. The existing ("base") attributes are added first, then values in
* newAttrs.
*
* @param existingAttrs The "base" attributes.
* @param newAttrs Coinciding attributes from here overwrite ones in existing attributes.
* @return A map containing a combination of the two maps.
*/
Map<String, Set<String>> mergeAttributes(Map<String, Set<String>> existingAttrs, Map<String, Set<String>> newAttrs) {
Map<String, Set<String>> mergedAttrs = new CaseInsensitiveHashMap(existingAttrs);
for (Map.Entry<String, Set<String>> attr : newAttrs.entrySet()) {
Set<String> values = attr.getValue();
Set<String> existingValues = mergedAttrs.get(attr.getKey());
if (existingValues == null) {
existingValues = new CaseInsensitiveHashSet();
mergedAttrs.put(attr.getKey(), existingValues);
}
existingValues.addAll(values);
}
return mergedAttrs;
}
Aggregations