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

Revert "Hide SSO authenticator in API response for Console and My account" #608

Closed
wants to merge 1 commit into from
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 @@ -76,9 +76,6 @@
import static org.wso2.carbon.identity.api.server.application.management.v1.core.functions.Utils.arrayToStream;
import static org.wso2.carbon.identity.api.server.application.management.v1.core.functions.application.UpdateAdvancedConfigurations.TYPE_JWKS;
import static org.wso2.carbon.identity.api.server.application.management.v1.core.functions.application.UpdateAdvancedConfigurations.TYPE_PEM;
import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.Application.CONSOLE_APP;
import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.Application.MY_ACCOUNT_APP;
import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.ORGANIZATION_AUTHENTICATOR;
import static org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants.ALLOWED_ROLE_AUDIENCE_PROPERTY_NAME;
import static org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants.ANDROID_PACKAGE_NAME_PROPERTY_NAME;
import static org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants.APPLE_APP_ID_PROPERTY_NAME;
Expand Down Expand Up @@ -209,9 +206,7 @@ private AuthenticationSequence buildAuthenticationSequence(ServiceProvider appli
authSequence.script(authConfig.getAuthenticationScriptConfig().getContent());
}

boolean hideOrganizationSsoAuthenticator = StringUtils.equals(application.getApplicationName(), CONSOLE_APP) ||
StringUtils.equals(application.getApplicationName(), MY_ACCOUNT_APP);
addAuthenticationStepInformation(hideOrganizationSsoAuthenticator, authConfig, authSequence);
addAuthenticationStepInformation(authConfig, authSequence);

List<String> requestPathAuthenticators = getRequestPathAuthenticators(application);
authSequence.setRequestPathAuthenticators(requestPathAuthenticators);
Expand All @@ -225,13 +220,12 @@ private List<String> getRequestPathAuthenticators(ServiceProvider application) {
return arrayToStream(requestPathConfigs).map(LocalAuthenticatorConfig::getName).collect(Collectors.toList());
}

private void addAuthenticationStepInformation(boolean hideOrganizationSsoAuthenticator,
LocalAndOutboundAuthenticationConfig authConfig,
private void addAuthenticationStepInformation(LocalAndOutboundAuthenticationConfig authConfig,
AuthenticationSequence authSequence) {

if (authConfig.getAuthenticationSteps() != null) {
Arrays.stream(authConfig.getAuthenticationSteps()).forEach(authenticationStep -> {
authSequence.addStepsItem(buildAuthStep(hideOrganizationSsoAuthenticator, authenticationStep));
authSequence.addStepsItem(buildAuthStep(authenticationStep));
if (authenticationStep.isSubjectStep()) {
authSequence.setSubjectStepId(authenticationStep.getStepOrder());
}
Expand Down Expand Up @@ -283,16 +277,13 @@ private ServiceProvider getDefaultServiceProvider() {
return defaultSP;
}

private AuthenticationStepModel buildAuthStep(boolean hideOrganizationSsoAuthenticator,
AuthenticationStep authenticationStep) {
private AuthenticationStepModel buildAuthStep(AuthenticationStep authenticationStep) {

AuthenticationStepModel authStep = new AuthenticationStepModel();
authStep.setId(authenticationStep.getStepOrder());

arrayToStream(authenticationStep.getFederatedIdentityProviders()).filter(y ->
!hideOrganizationSsoAuthenticator ||
!(ORGANIZATION_AUTHENTICATOR.equals(y.getDefaultAuthenticatorConfig().getName())))
.forEach(y -> authStep.addOptionsItem(new Authenticator().idp(y.getIdentityProviderName())
arrayToStream(authenticationStep.getFederatedIdentityProviders()).forEach(y -> authStep.addOptionsItem(
new Authenticator().idp(y.getIdentityProviderName())
.authenticator(y.getDefaultAuthenticatorConfig().getName())));

arrayToStream(authenticationStep.getLocalAuthenticatorConfigs()).forEach(y -> authStep.addOptionsItem(
Expand Down
Loading