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

Alias ID and Alias ZID for Identity Providers #2637

Merged

Conversation

adrianhoelzl-sap
Copy link
Contributor

@adrianhoelzl-sap adrianhoelzl-sap commented Dec 6, 2023

Issue #2505

Identity providers may be copied from the custom identity zone to the default identity zone (or vice versa) to enable customers to do user management in own identity zones

@adrianhoelzl-sap adrianhoelzl-sap added the DO NOT MERGE Internal Test or WIP, please DO NOT MERGE label Dec 6, 2023
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/186629962

The labels on this github issue will be updated when the story is started.

@klaus-sap
Copy link
Contributor

klaus-sap commented Dec 11, 2023

If alias_zid is set, replicate entry into alias identity zone. From default zone "uaa" you may replicate into any custom zone. From any custom zone, you may replicate into default zone "uaa" only.

throw new IllegalArgumentException("IdP type not supported.");
}
}
}
Copy link
Contributor

@Tallicia Tallicia Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be good coverage here, though I wonder if something is missed. I would prefer if there was a doc or matrix indicating conditions that maps to the tests to validate if any gaps exist.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a way to see the test coverage on the new code in SonarCloud. Overall coverage on new code is reported as 80.7% currently, just over the minimum threshold.

If I drill into IdentityProviderEndpoints.java, I see some if statement bodies with non-trivial code that would be nice to get test coverage for, plus some exceptions that aren't tested.

Also, Sonar indicates that there is one new code smell introduced in the PR that I'd like to see addressed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved the Sonar finding with e5f5791 and added some unit tests to increase the coverage with fafe033.

Copy link
Contributor

@swalchemist swalchemist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. If you want to make further refactoring from my comments here, I recommend merging this as-is and put additional changes in a new PR, so you can get this PR merged.

}

private static String buildMessagePrefix(@NonNull final IdentityProvider<?> idp) {
private static String buildMessagePrefix(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what code smell this particular change is addressing, but I think having 4 parameters vs. a single parameter class is also a code smell.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I changed this is the new method createNewAliasIdp in IdentityProviderEndpoints. With just the other constructor of IdpAliasFailedException being present, we would have to pass the original IdP as a parameter just for the exception case (e.g., e5f5791#diff-90da5e48423637b46ed07b703063b4fca4a0ee47cca8286548c91941b532fd07R566), even though all of the information for the exception message is also present in the alias IdP.

@@ -541,27 +541,43 @@ private <T extends AbstractIdentityProviderDefinition> IdentityProvider<?> ensur
return originalIdp;
}

final IdentityProvider<?> persistedAliasIdp = createNewAliasIdp(aliasIdp, originalIdp.getAliasZid());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change reducing the length of a long method. I'm curious what the Sonar smells are that all of these changes are addressing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix to the Sonar warning about the "Cognitive Complexity" being too high in this method.

@adrianhoelzl-sap adrianhoelzl-sap merged commit 8527254 into develop Feb 9, 2024
20 checks passed
@adrianhoelzl-sap adrianhoelzl-sap deleted the feature/alias-id-and-alias-zid-for-identity-providers branch February 9, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants