Skip to content

Commit

Permalink
Merge pull request #7394 from NipuniBhagya/sift-connector
Browse files Browse the repository at this point in the history
Refactor Sift connector integration page
  • Loading branch information
NipuniBhagya authored Jan 25, 2025
2 parents f559f78 + a9a3fc9 commit dbdd821
Show file tree
Hide file tree
Showing 15 changed files with 393 additions and 31 deletions.
8 changes: 8 additions & 0 deletions .changeset/kind-spoons-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@wso2is/admin.server-configurations.v1": patch
"@wso2is/admin.extensions.v1": patch
"@wso2is/console": patch
"@wso2is/i18n": patch
---

Improve Sift connector page
2 changes: 2 additions & 0 deletions apps/console/src/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@

--wso2is-admin-modal-form-max-width: 600px;
--wso2is-admin-form-max-width: 750px;

--negative-color: #E53535;
}
5 changes: 4 additions & 1 deletion features/admin.extensions.v1/configs/documentation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2024, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2021-2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -422,6 +422,9 @@ export const getDocumentationLinksExtension = () : DocumentationLinksExtensionIn
},
loginAttempts: {
learnMore: undefined
},
siftConnector: {
learnMore: undefined
}
},
logs: {
Expand Down
7 changes: 5 additions & 2 deletions features/admin.extensions.v1/configs/models/documentation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023-2024, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -41,7 +41,10 @@ interface LoginSecurityDocumentationLinksInterface {
},
loginAttempts: {
learnMore: string;
}
},
siftConnector: {
learnMore: string;
},
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2020-2024, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2020-2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -435,12 +435,17 @@ export class ServerConfigurationsConstants {
public static readonly ADMIN_FORCED_PASSWORD_RESET: string = "YWRtaW4tZm9yY2VkLXBhc3N3b3JkLXJlc2V0";
public static readonly PRIVATE_KEY_JWT_CLIENT_AUTH: string = "private-key-jwt-configuration";

public static readonly LOGIN_ATTEMPT_SECURITY: string = "login-attempt-security";

/**
* Organization Settings Category Constants.
*/
public static readonly ORGANIZATION_SETTINGS_CATEGORY_ID: string = "organization-settings";
public static readonly EMAIL_DOMAIN_DISCOVERY: string = "ZW1haWwtZG9tYWluLWRpc2NvdmVyeQ==";
public static readonly IMPERSONATION: string = "impersonation";

/**
* Login Security Category Constants.
*/
public static readonly SIFT_CONNECTOR_ID: string = "c2lmdC1jb25maWd1cmF0aW9u";
public static readonly LOGIN_ATTEMPT_SECURITY: string = "login-attempt-security";
public static readonly SIFT_CONNECTOR_API_KEY_PROPERTY: string = "__secret__.sift.api.key";
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2024, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2021-2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -16,11 +16,11 @@
* under the License.
*/

import { useRequiredScopes } from "@wso2is/access-control";
import { AppState, FeatureConfigInterface, history } from "@wso2is/admin.core.v1";
import { hasRequiredScopes } from "@wso2is/core/helpers";
import { TestableComponentInterface } from "@wso2is/core/models";
import kebabCase from "lodash-es/kebabCase";
import React, { FunctionComponent, ReactElement, useMemo } from "react";
import React, { FunctionComponent, ReactElement } from "react";
import { useSelector } from "react-redux";
import { AdminForcedPasswordResetForm } from "./admin-forced-password-reset";
import { AnalyticsConfigurationForm } from "./analytics-form";
Expand All @@ -29,6 +29,7 @@ import { LoginAttemptSecurityConfigurationFrom } from "./login-attempt-security-
import { MultiAttributeLoginForm } from "./multi-attribute-login";
import { PasswordRecoveryConfigurationForm } from "./password-recovery-form/password-recovery-form";
import { SelfRegistrationForm } from "./self-registration-form";
import SiftConnectorForm from "./sift-connector-form/sift-connector-form";
import { UsernameRecoveryConfigurationForm } from "./username-recovery-form";
import DynamicConnectorForm from "../components/governance-connectors/dynamic-connector-form";
import { ServerConfigurationsConstants } from "../constants/server-configurations-constants";
Expand Down Expand Up @@ -86,17 +87,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
} = props;

const featureConfig: FeatureConfigInterface = useSelector((state: AppState) => state.config.ui.features);
const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes);

const isReadOnly: boolean = useMemo(
() =>
!hasRequiredScopes(
featureConfig?.governanceConnectors,
featureConfig?.governanceConnectors?.scopes?.update,
allowedScopes
),
[ featureConfig, allowedScopes ]
);
const hasConnectorUpdatePermission: boolean = useRequiredScopes(featureConfig.governanceConnectors.scopes?.update);

const path: string[] = history?.location?.pathname?.split("/");
const type: string = path && path[ path.length - 3 ];
Expand Down Expand Up @@ -124,7 +115,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ isConnectorEnabled }
readOnly={ isReadOnly }
readOnly={ !hasConnectorUpdatePermission }
isSubmitting={ isSubmitting }
/>
);
Expand All @@ -134,7 +125,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ isConnectorEnabled }
readOnly={ isReadOnly }
readOnly={ !hasConnectorUpdatePermission }
isSubmitting={ isSubmitting }
/>
);
Expand All @@ -144,7 +135,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
<UsernameRecoveryConfigurationForm
onSubmit={ onSubmit }
initialValues={ initialValues }
readOnly={ isReadOnly }
readOnly={ !hasConnectorUpdatePermission }
/>
);
}
Expand All @@ -154,7 +145,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ isConnectorEnabled }
readOnly={ isReadOnly }
readOnly={ !hasConnectorUpdatePermission }
isSubmitting={ isSubmitting }
/>
);
Expand All @@ -164,7 +155,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ true }
readOnly={ isReadOnly }
readOnly={ !hasConnectorUpdatePermission }
isSubmitting={ isSubmitting }
/>
);
Expand All @@ -174,7 +165,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ true }
readOnly={ isReadOnly }
readOnly={ !hasConnectorUpdatePermission }
isSubmitting={ isSubmitting }
/>
);
Expand All @@ -184,7 +175,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ isConnectorEnabled }
readOnly={ isReadOnly }
readOnly={ !hasConnectorUpdatePermission }
isSubmitting={ isSubmitting }
/>
);
Expand All @@ -194,7 +185,16 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ isConnectorEnabled }
readOnly={ isReadOnly }
readOnly={ !hasConnectorUpdatePermission }
isSubmitting={ isSubmitting }
/>
);
case ServerConfigurationsConstants.SIFT_CONNECTOR_ID:
return (
<SiftConnectorForm
onSubmit={ onSubmit }
initialValues={ initialValues }
readOnly={ !hasConnectorUpdatePermission }
isSubmitting={ isSubmitting }
/>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

.sift-connector-form{
.oxygen-text-field {
min-width: 350px;
}

.MuiIconButton-root {
align-items: center;
margin-left: 9px;
margin-top: 22px;
}

.delete-button {
color: var(--negative-color);
min-width: 45px;
max-height: 45px;
padding: 0;
}
}
Loading

0 comments on commit dbdd821

Please sign in to comment.