Skip to content

Commit

Permalink
Fix org SSO authenticator not being shown in the login flow when the …
Browse files Browse the repository at this point in the history
…app is shared
  • Loading branch information
pavinduLakshan committed Jun 10, 2024
1 parent 9375baf commit a04bd9c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import AuthenticationFlowBuilder
from "@wso2is/admin.authentication-flow-builder.v1/components/authentication-flow-builder";
import AuthenticationFlowProvider
from "@wso2is/admin.authentication-flow-builder.v1/providers/authentication-flow-provider";
import useAuthorization from "@wso2is/admin.authorization.v1/hooks/use-authorization";
import { ConnectionsManagementUtils }
from "@wso2is/admin.connections.v1/utils/connection-utils";
import { AppConstants, EventPublisher, FeatureConfigInterface, history } from "@wso2is/admin.core.v1";
Expand Down Expand Up @@ -156,7 +155,6 @@ export const SignOnMethodsCore: FunctionComponent<SignOnMethodsCorePropsInterfac
const { t } = useTranslation();
const { UIConfig } = useUIConfig();
const dispatch: Dispatch = useDispatch();
const { legacyAuthzRuntime } = useAuthorization();

const connectionResourcesUrl: string = UIConfig?.connectionResourcesUrl;
const isApplicationShared: boolean = application?.advancedConfigurations?.additionalSpProperties?.find(
Expand Down Expand Up @@ -279,11 +277,8 @@ export const SignOnMethodsCore: FunctionComponent<SignOnMethodsCorePropsInterfac
setMicrosoftAuthenticators(microsoft);
setAppleAuthenticators(apple);

// If the current runtime is legacy (old) runtime, add the organization sso
// authenticator to the connections list.
if (legacyAuthzRuntime) {
response[1].push(OrganizationUtils.getOrganizationAuthenticator());
}
// Add the organization sso authenticator to the connections list.
response[1].push(OrganizationUtils.getOrganizationAuthenticator());

setAuthenticators(response);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,26 @@ export const AddAuthenticatorModal: FunctionComponent<AddAuthenticatorModalProps
t(AuthenticatorMeta.getAuthenticatorTypeDisplayName(AuthenticatorCategories.RECOVERY)))
];

// Remove SMS OTP authenticator from the list at the sub org level.
_filteredAuthenticators = (orgType === OrganizationType.SUBORGANIZATION &&
identityProviderConfig?.disableSMSOTPInSubOrgs)
? _filteredAuthenticators.filter((authenticator: GenericAuthenticatorInterface) => {
// Remove SMS OTP authenticator from the list for sub orgs, if the SMS OTP for sub orgs is disabled.
if (orgType === OrganizationType.SUBORGANIZATION && identityProviderConfig?.disableSMSOTPInSubOrgs) {
_filteredAuthenticators = _filteredAuthenticators.filter((authenticator: GenericAuthenticatorInterface) => {
return (
authenticator.name !==
IdentityProviderManagementConstants.SMS_OTP_AUTHENTICATOR_ID &&
authenticator.name !==authenticatorConfig?.overriddenAuthenticatorNames
?.SMS_OTP_AUTHENTICATOR
);
})
: _filteredAuthenticators;
});
}

// Remove organization SSO authenticator from the list, as organization SSO authenticator
// should be handled automatically in the login flow, based on whether the app is shared or not.
_filteredAuthenticators = _filteredAuthenticators.filter((authenticator: GenericAuthenticatorInterface) => {
return (
authenticator.name !==
IdentityProviderManagementConstants.ORGANIZATION_AUTHENTICATOR
);
});

setFilteredAuthenticators(_filteredAuthenticators);
setAllAuthenticators(_filteredAuthenticators);
Expand Down

0 comments on commit a04bd9c

Please sign in to comment.