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

Cleanup identity-providers feature (Pt.10) #6679

Merged
merged 18 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
aba518f
Revamp error message constants in `admin.identity-providers` feature
JayaShakthi97 Jul 26, 2024
d28ee8c
Move federated authenticator related constants
JayaShakthi97 Jul 26, 2024
56f21d6
Move federated authenticator constants
JayaShakthi97 Jul 26, 2024
7bf327e
Restructure identity-provider constants
JayaShakthi97 Jul 29, 2024
4910beb
Restructure constants
JayaShakthi97 Jul 29, 2024
4ab4520
Restructure identity-provider constants
JayaShakthi97 Jul 29, 2024
c582838
Restructure identity-provider constants
JayaShakthi97 Jul 29, 2024
a59f677
Restructure identity-provider constants
JayaShakthi97 Jul 29, 2024
0b7ab17
Move unnecessary extension config to constants
JayaShakthi97 Jul 29, 2024
f477590
Restructure authenticator names constants in identity-providers feature
JayaShakthi97 Jul 29, 2024
2e201ac
Migrate to `useRequiredScopes` hook
JayaShakthi97 Jul 29, 2024
f7d250f
Restructure authenticator name constants in identity-providers feature
JayaShakthi97 Jul 29, 2024
84eb8e9
Restructure authenticator name constants in identity-providers
JayaShakthi97 Jul 29, 2024
1405667
Restructure authenticator name constants in identity-providers feature
JayaShakthi97 Jul 30, 2024
78785b0
Restructure authenticator name constants in identity-providers feature
JayaShakthi97 Jul 30, 2024
c2c0542
Move unnecessary extension config to constants
JayaShakthi97 Jul 30, 2024
85b140b
Delete `IdentityProviderManagementConstants` file from admin.identity…
JayaShakthi97 Jul 30, 2024
40fee44
Add changeset 🦋
JayaShakthi97 Jul 30, 2024
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
10 changes: 10 additions & 0 deletions .changeset/silent-ears-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@wso2is/admin.authentication-flow-builder.v1": patch
"@wso2is/admin.identity-providers.v1": patch
"@wso2is/admin.login-flow.ai.v1": patch
"@wso2is/admin.applications.v1": patch
"@wso2is/admin.connections.v1": patch
"@wso2is/admin.extensions.v1": patch
---

Cleanup authenticator constants in admin.identity-providers feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ import {
import {
FederatedAuthenticatorConstants
} from "@wso2is/admin.connections.v1/constants/federated-authenticator-constants";
import { LocalAuthenticatorConstants } from "@wso2is/admin.connections.v1/constants/local-authenticator-constants";
import { ConnectionsManagementUtils }
from "@wso2is/admin.connections.v1/utils/connection-utils";
import { AppConstants, EventPublisher, FeatureConfigInterface, history } from "@wso2is/admin.core.v1";
import useUIConfig from "@wso2is/admin.core.v1/hooks/use-ui-configs";
import {
IdentityProviderManagementConstants
} from "@wso2is/admin.identity-providers.v1/constants/identity-provider-management-constants";
import MicrosoftIDPTemplate
from
"@wso2is/admin.identity-providers.v1/data/identity-provider-templates/templates/microsoft/microsoft.json";
Expand Down Expand Up @@ -252,19 +250,19 @@ export const SignOnMethodsCore: FunctionComponent<SignOnMethodsCorePropsInterfac

response[1].filter((authenticator: GenericAuthenticatorInterface) => {
if (authenticator.defaultAuthenticator.authenticatorId
=== IdentityProviderManagementConstants.GOOGLE_OIDC_AUTHENTICATOR_ID) {
=== FederatedAuthenticatorConstants.AUTHENTICATOR_IDS.GOOGLE_OIDC_AUTHENTICATOR_ID) {

google.push(authenticator);
} else if (authenticator.defaultAuthenticator.authenticatorId
=== IdentityProviderManagementConstants.GITHUB_AUTHENTICATOR_ID) {
=== FederatedAuthenticatorConstants.AUTHENTICATOR_IDS.GITHUB_AUTHENTICATOR_ID) {

gitHub.push(authenticator);
} else if (authenticator.defaultAuthenticator.authenticatorId
=== IdentityProviderManagementConstants.FACEBOOK_AUTHENTICATOR_ID) {
=== FederatedAuthenticatorConstants.AUTHENTICATOR_IDS.FACEBOOK_AUTHENTICATOR_ID) {

facebook.push(authenticator);
} else if (authenticator.defaultAuthenticator.authenticatorId
=== IdentityProviderManagementConstants.MICROSOFT_AUTHENTICATOR_ID &&
=== FederatedAuthenticatorConstants.AUTHENTICATOR_IDS.MICROSOFT_AUTHENTICATOR_ID &&
authenticator.description === MicrosoftIDPTemplate.description) {

microsoft.push(authenticator);
Expand Down Expand Up @@ -326,7 +324,7 @@ export const SignOnMethodsCore: FunctionComponent<SignOnMethodsCorePropsInterfac
}

const isBasicStep: boolean = authenticationSequence.steps[0].options[0].authenticator
=== IdentityProviderManagementConstants.BASIC_AUTHENTICATOR;
=== LocalAuthenticatorConstants.AUTHENTICATOR_NAMES.BASIC_AUTHENTICATOR_NAME;
const isBasicScript: boolean = !authenticationSequence.script
||AdaptiveScriptUtils.isDefaultScript(authenticationSequence.script, authenticationSequence.steps?.length);

Expand Down Expand Up @@ -605,19 +603,19 @@ export const SignOnMethodsCore: FunctionComponent<SignOnMethodsCorePropsInterfac

if (loginType === LoginFlowTypes.GOOGLE_LOGIN) {
modifiedSequenceTemplate = cloneDeep(GoogleLoginSequenceTemplate);
authenticatorType = IdentityProviderManagementConstants.GOOGLE_OIDC_AUTHENTICATOR_NAME;
authenticatorType = FederatedAuthenticatorConstants.AUTHENTICATOR_NAMES.GOOGLE_OIDC_AUTHENTICATOR_NAME;
} else if (loginType === LoginFlowTypes.GITHUB_LOGIN) {
modifiedSequenceTemplate = cloneDeep(GitHubLoginSequenceTemplate);
authenticatorType = IdentityProviderManagementConstants.GITHUB_AUTHENTICATOR_NAME;
authenticatorType = FederatedAuthenticatorConstants.AUTHENTICATOR_NAMES.GITHUB_AUTHENTICATOR_NAME;
} else if (loginType === LoginFlowTypes.FACEBOOK_LOGIN) {
modifiedSequenceTemplate = cloneDeep(FacebookLoginSequenceTemplate);
authenticatorType = IdentityProviderManagementConstants.FACEBOOK_AUTHENTICATOR_NAME;
authenticatorType = FederatedAuthenticatorConstants.AUTHENTICATOR_NAMES.FACEBOOK_AUTHENTICATOR_NAME;
} else if (loginType === LoginFlowTypes.MICROSOFT_LOGIN) {
modifiedSequenceTemplate = cloneDeep(MicrosoftLoginSequenceTemplate);
authenticatorType = IdentityProviderManagementConstants.MICROSOFT_AUTHENTICATOR_NAME;
authenticatorType = FederatedAuthenticatorConstants.AUTHENTICATOR_NAMES.MICROSOFT_AUTHENTICATOR_NAME;
} else if (loginType === LoginFlowTypes.APPLE_LOGIN) {
modifiedSequenceTemplate = cloneDeep(AppleLoginSequenceTemplate);
authenticatorType = IdentityProviderManagementConstants.APPLE_AUTHENTICATOR_NAME;
authenticatorType = FederatedAuthenticatorConstants.AUTHENTICATOR_NAMES.APPLE_AUTHENTICATOR_NAME;
}
modifiedSequenceTemplate.steps[0].options.forEach((option: AuthenticatorInterface) => {
if (option.authenticator === authenticatorType) {
Expand All @@ -640,19 +638,24 @@ export const SignOnMethodsCore: FunctionComponent<SignOnMethodsCorePropsInterfac

if (socialDisclaimerModalType === LoginFlowTypes.GOOGLE_LOGIN) {
idpTemplateTypeToTrigger = CommonAuthenticatorManagementConstants.CONNECTION_TEMPLATE_IDS.GOOGLE;
authenticatorName = IdentityProviderManagementConstants.GOOGLE_OIDC_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.GOOGLE_OIDC_AUTHENTICATOR_DISPLAY_NAME;
} else if (socialDisclaimerModalType === LoginFlowTypes.GITHUB_LOGIN) {
idpTemplateTypeToTrigger = CommonAuthenticatorManagementConstants.CONNECTION_TEMPLATE_IDS.GITHUB;
authenticatorName = IdentityProviderManagementConstants.GITHUB_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.GITHUB_AUTHENTICATOR_DISPLAY_NAME;
} else if (socialDisclaimerModalType === LoginFlowTypes.FACEBOOK_LOGIN) {
idpTemplateTypeToTrigger = CommonAuthenticatorManagementConstants.CONNECTION_TEMPLATE_IDS.FACEBOOK;
authenticatorName = IdentityProviderManagementConstants.FACEBOOK_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.FACEBOOK_AUTHENTICATOR_DISPLAY_NAME;
} else if (socialDisclaimerModalType === LoginFlowTypes.MICROSOFT_LOGIN) {
idpTemplateTypeToTrigger = CommonAuthenticatorManagementConstants.CONNECTION_TEMPLATE_IDS.MICROSOFT;
authenticatorName = IdentityProviderManagementConstants.MICROSOFT_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.MICROSOFT_AUTHENTICATOR_DISPLAY_NAME;
} else if (socialDisclaimerModalType === LoginFlowTypes.APPLE_LOGIN) {
idpTemplateTypeToTrigger = CommonAuthenticatorManagementConstants.CONNECTION_TEMPLATE_IDS.APPLE;
authenticatorName = IdentityProviderManagementConstants.APPLE_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.APPLE_AUTHENTICATOR_DISPLAY_NAME;
} else {
return null;
}
Expand Down Expand Up @@ -732,19 +735,24 @@ export const SignOnMethodsCore: FunctionComponent<SignOnMethodsCorePropsInterfac

if (socialDisclaimerModalType === LoginFlowTypes.GOOGLE_LOGIN) {
authenticators = [ ...googleAuthenticators ];
authenticatorName = IdentityProviderManagementConstants.GOOGLE_OIDC_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.GOOGLE_OIDC_AUTHENTICATOR_DISPLAY_NAME;
} else if (socialDisclaimerModalType === LoginFlowTypes.GITHUB_LOGIN) {
authenticators = [ ...gitHubAuthenticators ];
authenticatorName = IdentityProviderManagementConstants.GITHUB_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.GITHUB_AUTHENTICATOR_DISPLAY_NAME;
} else if (socialDisclaimerModalType === LoginFlowTypes.FACEBOOK_LOGIN) {
authenticators = [ ...facebookAuthenticators ];
authenticatorName = IdentityProviderManagementConstants.FACEBOOK_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.FACEBOOK_AUTHENTICATOR_DISPLAY_NAME;
} else if (socialDisclaimerModalType === LoginFlowTypes.MICROSOFT_LOGIN) {
authenticators = [ ...microsoftAuthenticators ];
authenticatorName = IdentityProviderManagementConstants.MICROSOFT_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.MICROSOFT_AUTHENTICATOR_DISPLAY_NAME;
} else if (socialDisclaimerModalType === LoginFlowTypes.APPLE_LOGIN) {
authenticators = [ ...appleAuthenticators ];
authenticatorName = IdentityProviderManagementConstants.APPLE_AUTHENTICATOR_DISPLAY_NAME;
authenticatorName = FederatedAuthenticatorConstants
.AUTHENTICATOR_DISPLAY_NAMES.APPLE_AUTHENTICATOR_DISPLAY_NAME;
} else {
return null;
}
Expand Down Expand Up @@ -811,8 +819,8 @@ export const SignOnMethodsCore: FunctionComponent<SignOnMethodsCorePropsInterfac
{
authenticators
.filter((authenticator: GenericAuthenticatorInterface) => {
return authenticator.name !== IdentityProviderManagementConstants
.BACKUP_CODE_AUTHENTICATOR;
return authenticator.name !== LocalAuthenticatorConstants.AUTHENTICATOR_NAMES
.BACKUP_CODE_AUTHENTICATOR_NAME;
})
.map((authenticator: GenericAuthenticatorInterface, index: number) => (
<LabeledCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import useAuthenticationFlow from "@wso2is/admin.authentication-flow-builder.v1/hooks/use-authentication-flow";
import { AuthenticatorManagementConstants } from "@wso2is/admin.connections.v1";
import { getMultiFactorAuthenticatorDetails } from "@wso2is/admin.connections.v1/api/authenticators";
import { LocalAuthenticatorConstants } from "@wso2is/admin.connections.v1/constants/local-authenticator-constants";
import {
AppConstants,
AppState,
Expand All @@ -27,9 +28,6 @@ import {
history
} from "@wso2is/admin.core.v1";
import useGlobalVariables from "@wso2is/admin.core.v1/hooks/use-global-variables";
import {
IdentityProviderManagementConstants
} from "@wso2is/admin.identity-providers.v1/constants/identity-provider-management-constants";
import { GenericAuthenticatorInterface } from "@wso2is/admin.identity-providers.v1/models/identity-provider";
import { OrganizationType } from "@wso2is/admin.organizations.v1/constants";
import {
Expand Down Expand Up @@ -608,15 +606,17 @@ export const SignInMethodCustomization: FunctionComponent<SignInMethodCustomizat
(step: AuthenticationStepInterface) =>
!!step?.options.find(
(authenticator: AuthenticatorInterface) =>
authenticator?.authenticator === IdentityProviderManagementConstants.FIDO_AUTHENTICATOR
authenticator?.authenticator === LocalAuthenticatorConstants.AUTHENTICATOR_NAMES
.FIDO_AUTHENTICATOR_NAME
)
);

if (isPasskeyIncludedInAnyStep) {
if (isPasskeyProgressiveEnrollmentEnabled) {
const isPasskeyIncludedAsAFirstFatorOption: boolean = !!authenticationSequence?.steps[0]?.options.find(
(authenticator: AuthenticatorInterface) =>
authenticator?.authenticator === IdentityProviderManagementConstants.FIDO_AUTHENTICATOR
authenticator?.authenticator === LocalAuthenticatorConstants.AUTHENTICATOR_NAMES
.FIDO_AUTHENTICATOR_NAME
);

if (isPasskeyIncludedAsAFirstFatorOption) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
*/
import useAuthenticationFlow from "@wso2is/admin.authentication-flow-builder.v1/hooks/use-authentication-flow";
import { ConnectionManagementConstants } from "@wso2is/admin.connections.v1/constants/connection-constants";
import { LocalAuthenticatorConstants } from "@wso2is/admin.connections.v1/constants/local-authenticator-constants";
import { EventPublisher, FeatureConfigInterface } from "@wso2is/admin.core.v1";
import useDeploymentConfig from "@wso2is/admin.core.v1/hooks/use-deployment-configs";
import {
IdentityProviderManagementConstants
} from "@wso2is/admin.identity-providers.v1/constants/identity-provider-management-constants";
import { IdentifiableComponentInterface, SBACInterface } from "@wso2is/core/models";
import { Heading, InfoCard, useMediaContext } from "@wso2is/react-components";
import React, { FunctionComponent, ReactElement } from "react";
Expand Down Expand Up @@ -233,7 +231,7 @@ export const SignInMethodLanding: FunctionComponent<SignInMethodLandingPropsInte
</Heading>
{ !hiddenOptions?.includes(LoginFlowTypes.FIDO_LOGIN) &&
!hiddenAuthenticators?.includes(
IdentityProviderManagementConstants.FIDO_AUTHENTICATOR
LocalAuthenticatorConstants.AUTHENTICATOR_NAMES.FIDO_AUTHENTICATOR_NAME
) && (
<InfoCard
fluid
Expand Down Expand Up @@ -262,7 +260,7 @@ export const SignInMethodLanding: FunctionComponent<SignInMethodLandingPropsInte
) }
{ !hiddenOptions?.includes(LoginFlowTypes.MAGIC_LINK) &&
!hiddenAuthenticators?.includes(
IdentityProviderManagementConstants.MAGIC_LINK_AUTHENTICATOR
LocalAuthenticatorConstants.AUTHENTICATOR_NAMES.MAGIC_LINK_AUTHENTICATOR_NAME
) && (
<InfoCard
fluid
Expand Down Expand Up @@ -292,7 +290,7 @@ export const SignInMethodLanding: FunctionComponent<SignInMethodLandingPropsInte
) }
{ !hiddenOptions?.includes(LoginFlowTypes.EMAIL_OTP) &&
!hiddenAuthenticators?.includes(
IdentityProviderManagementConstants.EMAIL_OTP_AUTHENTICATOR_ID
LocalAuthenticatorConstants.AUTHENTICATOR_IDS.EMAIL_OTP_AUTHENTICATOR_ID
) && (
<InfoCard
fluid
Expand Down Expand Up @@ -322,7 +320,7 @@ export const SignInMethodLanding: FunctionComponent<SignInMethodLandingPropsInte
) }
{ !hiddenOptions?.includes(LoginFlowTypes.SMS_OTP) &&
!hiddenAuthenticators?.includes(
IdentityProviderManagementConstants.SMS_OTP_AUTHENTICATOR_ID
LocalAuthenticatorConstants.AUTHENTICATOR_IDS.SMS_OTP_AUTHENTICATOR_ID
) && (
<InfoCard
fluid
Expand Down
Loading
Loading