Skip to content

Commit

Permalink
Merge pull request #117 from neojunjie/keycloak_groups
Browse files Browse the repository at this point in the history
Splitting up groups by "/" delimiter
  • Loading branch information
neojunjie authored Sep 12, 2023
2 parents d918411 + d82f2dd commit 5b5c620
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions datahub-frontend/app/auth/sso/oidc/OidcCallbackLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,19 @@ private List<CorpGroupSnapshot> extractGroups(CommonProfile profile) {
groupNames = Collections.emptyList();
}

for (String groupName : groupNames) {
Collection<String> splitGroupNames = new ArrayList<String>();

// Split groups that are delimited by /
for (String groupName: groupNames) {
Collection<String> splitGroups = Arrays.stream(groupName.split("/"))
.filter(name -> name.trim().length() > 0)
.collect(Collectors.toList());
splitGroupNames.addAll(splitGroups);
}

for (String groupName : splitGroupNames) {
// Create a basic CorpGroupSnapshot from the information.
try {

final CorpGroupInfo corpGroupInfo = new CorpGroupInfo();
corpGroupInfo.setAdmins(new CorpuserUrnArray());
corpGroupInfo.setGroups(new CorpGroupUrnArray());
Expand Down Expand Up @@ -423,8 +432,10 @@ private void tryProvisionGroups(List<CorpGroupSnapshot> corpGroups) {
log.debug(String.format("Extracted group that does not yet exist %s. Provisioning...",
corpGroupSnapshot.getUrn()));
groupsToCreate.add(extractedGroup);
} else {
log.debug(String.format("Group %s already exists. Skipping provisioning", corpGroupSnapshot.getUrn()));
}
log.debug(String.format("Group %s already exists. Skipping provisioning", corpGroupSnapshot.getUrn()));

} else {
// Should not occur until we stop returning default Key aspects for unrecognized entities.
log.debug(
Expand Down

0 comments on commit 5b5c620

Please sign in to comment.