Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attribute profiles properties to scim2/Schemas #595

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5835,8 +5835,19 @@ private Map<String, Attribute> getFilteredSchemaAttributes(Map<ExternalClaim, Lo

private boolean isSupportedByDefault(LocalClaim mappedLocalClaim) {

String supportedByDefault = mappedLocalClaim.getClaimProperty(ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY);
return Boolean.parseBoolean(supportedByDefault);
String globalSupportedByDefault =
mappedLocalClaim.getClaimProperty(ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY);

boolean profileSpecificSupportedByDefault = mappedLocalClaim.getClaimProperties().entrySet().stream()
.filter(entry -> StringUtils.startsWith(entry.getKey(), ClaimConstants.PROFILES_CLAIM_PROPERTY_PREFIX))
.anyMatch(entry -> {
String[] profilePropertyKeyArray = entry.getKey().split("\\.");
return profilePropertyKeyArray.length == 3 &&
StringUtils.endsWith(entry.getKey(), ClaimConstants.SUPPORTED_BY_DEFAULT_PROPERTY) &&
Boolean.parseBoolean(entry.getValue());
});

return Boolean.parseBoolean(globalSupportedByDefault) || profileSpecificSupportedByDefault;
}

private boolean isUsernameClaim(ExternalClaim scimClaim) {
Expand Down Expand Up @@ -6041,6 +6052,15 @@ private void populateBasicAttributes(LocalClaim mappedLocalClaim, AbstractAttrib
attribute.addAttributeProperty(SHARED_PROFILE_VALUE_RESOLVING_METHOD_PROPERTY,
mappedLocalClaim.getClaimProperty(ClaimConstants.SHARED_PROFILE_VALUE_RESOLVING_METHOD));
}

// Add attribute profile properties.
for (Map.Entry<String, String> entry: mappedLocalClaim.getClaimProperties().entrySet()) {
String propertyKey = entry.getKey();
String propertyValue = entry.getValue();
if (StringUtils.startsWith(propertyKey, ClaimConstants.PROFILES_CLAIM_PROPERTY_PREFIX)) {
attribute.addAttributeProperty(propertyKey, propertyValue);
}
}
}
}

Expand Down
Loading