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

Fix 16482 #479

Merged
merged 3 commits into from
Sep 1, 2023
Merged
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 @@ -83,6 +83,7 @@ public class ServiceProviderToApiModel implements Function<ServiceProvider, Appl
private static final Set<String> systemApplications = ApplicationManagementServiceHolder
.getApplicationManagementService().getSystemApplications();
private static final String IS_FRAGMENT_APP = "isFragmentApp";
private static final String useUserIdForDefaultSubject = "useUserIdForDefaultSubject";

@Override
public ApplicationResponseModel apply(ServiceProvider application) {
Expand Down Expand Up @@ -283,9 +284,7 @@ private SubjectConfig buildSubjectClaimConfig(ServiceProvider application) {
subjectConfig.includeUserDomain(localAndOutboundAuthConfig.isUseUserstoreDomainInLocalSubjectIdentifier());

if (StringUtils.isBlank(localAndOutboundAuthConfig.getSubjectClaimUri())) {
if (isLocalClaimDialectUsedBySp(application)) {
subjectConfig.claim(buildClaimModel(FrameworkConstants.USERNAME_CLAIM));
}
assignClaimForSubjectValue(application, subjectConfig);
} else {
subjectConfig.claim(buildClaimModel(localAndOutboundAuthConfig.getSubjectClaimUri()));
}
Expand All @@ -294,6 +293,27 @@ private SubjectConfig buildSubjectClaimConfig(ServiceProvider application) {
return subjectConfig;
}

private void assignClaimForSubjectValue(ServiceProvider application, SubjectConfig subjectConfig) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a new line after this method signature.


if (isLocalClaimDialectUsedBySp(application)) {
if (isUserIdUsedAsDefaultSubject(application.getSpProperties())) {
subjectConfig.claim(buildClaimModel(FrameworkConstants.USER_ID_CLAIM));
} else {
subjectConfig.claim(buildClaimModel(FrameworkConstants.USERNAME_CLAIM));
}
}
}

private boolean isUserIdUsedAsDefaultSubject (ServiceProviderProperty[] spProperties) {

for (ServiceProviderProperty spProperty : spProperties) {
if (useUserIdForDefaultSubject.equals(spProperty.getName())) {
return true;
}
}
return false;
}

private ClaimConfiguration.DialectEnum getDialect(ServiceProvider application) {

if (isLocalClaimDialectUsedBySp(application)) {
Expand Down
Loading