Skip to content
Draft
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions .changeset/neat-lobsters-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@wso2is/admin.authentication.v1": patch
"@wso2is/admin.core.v1": patch
"@wso2is/console": patch
---

Reduce circular dependencies between `admin.core.v1`, `admin.actions.v1` and `admin.connections.v1`
12 changes: 10 additions & 2 deletions apps/console/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

import { BasicUserInfo, DecodedIDTokenPayload, useAuthContext } from "@asgardeo/auth-react";
import { AccessControlProvider, AllFeatureInterface, FeatureGateInterface } from "@wso2is/access-control";
import { getActionsResourceEndpoints } from "@wso2is/admin.actions.v1/configs/endpoints";
import useCDSConfig from "@wso2is/admin.cds.v1/hooks/use-config";
import { getConnectionResourceEndpoints } from "@wso2is/admin.connections.v1/configs/endpoints";
import { PreLoader } from "@wso2is/admin.core.v1/components/pre-loader";
import { ProtectedRoute } from "@wso2is/admin.core.v1/components/protected-route";
import { Config } from "@wso2is/admin.core.v1/configs/app";
Expand Down Expand Up @@ -240,9 +242,15 @@ export const App = ({
* Set the deployment configs in redux state.
*/
useEffect(() => {
dispatch(setServiceResourceEndpoints<ServiceResourceEndpointsInterface>(Config.getServiceResourceEndpoints()));
const serviceResourceEndpoints: ServiceResourceEndpointsInterface = {
...Config.getServiceResourceEndpoints(),
...getActionsResourceEndpoints(Config.resolveServerHost()),
...getConnectionResourceEndpoints(Config.resolveServerHost())
};

dispatch(setServiceResourceEndpoints<ServiceResourceEndpointsInterface>(serviceResourceEndpoints));
dispatch(setI18nConfigs<I18nModuleOptionsInterface>(Config.getI18nConfig()));
setResourceEndpoints(Config.getServiceResourceEndpoints() as any);
setResourceEndpoints(serviceResourceEndpoints as any);
}, [ AppConstants.getTenantQualifiedAppBasename() ]);

/**
Expand Down
16 changes: 13 additions & 3 deletions apps/console/src/protected-app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022-2024, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2022-2026, 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 @@ -23,15 +23,20 @@ import {
SecureApp,
useAuthContext
} from "@asgardeo/auth-react";
import { getActionsResourceEndpoints } from "@wso2is/admin.actions.v1/configs/endpoints";
import useSignIn from "@wso2is/admin.authentication.v1/hooks/use-sign-in";
import { getConnectionResourceEndpoints } from "@wso2is/admin.connections.v1/configs/endpoints";
import { PreLoader } from "@wso2is/admin.core.v1/components/pre-loader";
import { Config } from "@wso2is/admin.core.v1/configs/app";
import { AppConstants } from "@wso2is/admin.core.v1/constants/app-constants";
import { MultitenantConstants } from "@wso2is/admin.core.v1/constants/multitenant-constants";
import { history } from "@wso2is/admin.core.v1/helpers/history";
import useUIConfig from "@wso2is/admin.core.v1/hooks/use-ui-configs";
import { AppComponentProps } from "@wso2is/admin.core.v1/models/common";
import { DeploymentConfigInterface, UIConfigInterface } from "@wso2is/admin.core.v1/models/config";
import {
DeploymentConfigInterface,
UIConfigInterface
} from "@wso2is/admin.core.v1/models/config";
import { AppState, store } from "@wso2is/admin.core.v1/store";
import { setFilteredDevelopRoutes, setSanitizedDevelopRoutes } from "@wso2is/admin.core.v1/store/actions/routes";
import { AppUtils } from "@wso2is/admin.core.v1/utils/app-utils";
Expand Down Expand Up @@ -175,7 +180,12 @@ export const ProtectedApp: FunctionComponent<AppPropsInterface> = (): ReactEleme
response,
() => null,
(idToken: DecodedIDTokenPayload) => loginSuccessRedirect(idToken),
() => setRenderApp(true)
() => setRenderApp(true),
() => ({
...Config.getServiceResourceEndpoints(),
...getActionsResourceEndpoints(Config.resolveServerHost()),
...getConnectionResourceEndpoints(Config.resolveServerHost())
})
);
} catch(e) {
// TODO: Handle error
Expand Down
27 changes: 17 additions & 10 deletions features/admin.authentication.v1/hooks/use-sign-in.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023-2025, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2026, 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 @@ -82,6 +82,7 @@ export type UseSignInInterface = {
* @param onTenantResolve - Callback to be triggered when tenant is resolved.
* @param onSignInSuccessRedirect - Callback to be triggered when sign in is successful.
* @param onAppReady - Callback to be triggered when the app is ready.
* @param resourceEndpoints - The resource endpoints.
*
* @returns A promise.
*/
Expand All @@ -90,6 +91,7 @@ export type UseSignInInterface = {
onTenantResolve: (tenantDomain: string) => void,
onSignInSuccessRedirect: (idToken: DecodedIDTokenPayload) => void,
onAppReady: () => void,
resourceEndpoints?: Record<string, any>
) => Promise<void>;
};

Expand Down Expand Up @@ -206,20 +208,25 @@ const useSignIn = (): UseSignInInterface => {
* @param onTenantResolve - Callback to be triggered when tenant is resolved.
* @param onSignInSuccessRedirect - Callback to be triggered when sign in is successful.
* @param onAppReady - Callback to be triggered when the app is ready.
* @param endpointResolver - Optional callback invoked after the server host is resolved
* to produce the full set of service resource endpoints. Defaults to
* `Config.getServiceResourceEndpoints()`.
*
* @returns A promise.
*/
const onSignIn = async (
response: BasicUserInfo,
onTenantResolve: (tenantDomain: string) => void,
onSignInSuccessRedirect: (idToken: DecodedIDTokenPayload) => void,
onAppReady: () => void
onAppReady: () => void,
endpointResolver: () => Record<string, any> = Config.getServiceResourceEndpoints.bind(Config)
): Promise<void> => {
await _onSignIn(
response,
onTenantResolve,
onSignInSuccessRedirect,
onAppReady
onAppReady,
endpointResolver
);
};

Expand All @@ -230,14 +237,16 @@ const useSignIn = (): UseSignInInterface => {
* @param onTenantResolve - Callback to be triggered when tenant is resolved.
* @param onSignInSuccessRedirect - Callback to be triggered when sign in is successful.
* @param onAppReady - Callback to be triggered when the app is ready.
* @param endpointResolver - Callback invoked after server host resolution to produce endpoints.
*
* @returns A promise.
*/
const _onSignIn = async (
response: BasicUserInfo,
onTenantResolve: (tenantDomain: string) => void,
onSignInSuccessRedirect: (idToken: DecodedIDTokenPayload) => void,
onAppReady: () => void
onAppReady: () => void,
endpointResolver: () => Record<string, string>
): Promise<void> => {
const idToken: DecodedIDTokenPayload = await getDecodedIDToken();

Expand Down Expand Up @@ -356,10 +365,10 @@ const useSignIn = (): UseSignInInterface => {
dispatch(setCurrentOrganization(orgName));

// This is to make sure the endpoints are generated with the organization path.
await dispatch(setServiceResourceEndpoints(Config.getServiceResourceEndpoints()));
await dispatch(setServiceResourceEndpoints(endpointResolver()));

// Sets the resource endpoints in the context.
setResourceEndpoints(Config.getServiceResourceEndpoints() as any);
setResourceEndpoints(endpointResolver() as any);

try {
response = await switchOrganization(orgId);
Expand All @@ -374,13 +383,11 @@ const useSignIn = (): UseSignInInterface => {

dispatch(setGetOrganizationLoading(false));

const endpoints: Record<string, any> = Config.getServiceResourceEndpoints();

// Update the endpoints with tenant path.
await dispatch(setServiceResourceEndpoints(endpoints));
await dispatch(setServiceResourceEndpoints(endpointResolver()));

// Sets the resource endpoints in the context.
setResourceEndpoints(endpoints);
setResourceEndpoints(endpointResolver() as any);

// When the tenant domain changes, we have to reset the auth callback in session storage.
// If not, it will hang and the app will be unresponsive with in the tab.
Expand Down
15 changes: 10 additions & 5 deletions features/admin.core.v1/configs/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023-2025, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2026, 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,7 +16,6 @@
* under the License.
*/

import { getActionsResourceEndpoints } from "@wso2is/admin.actions.v1/configs/endpoints";
import { getAdministratorsResourceEndpoints } from "@wso2is/admin.administrators.v1/config/endpoints";
import { getAgentsResourceEndpoints } from "@wso2is/admin.agents.v1/configs/endpoints";
import { getAPIResourceEndpoints } from "@wso2is/admin.api-resources.v2/configs/endpoint";
Expand All @@ -34,7 +33,6 @@ import { getCustomerDataServiceEndpoints } from "@wso2is/admin.cds.v1/configs/en
import { getCertificatesResourceEndpoints } from "@wso2is/admin.certificates.v1";
import { getClaimResourceEndpoints } from "@wso2is/admin.claims.v1/configs/endpoints";
import { ClaimManagementConstants } from "@wso2is/admin.claims.v1/constants/claim-management-constants";
import { getConnectionResourceEndpoints } from "@wso2is/admin.connections.v1";
import { getEmailTemplatesResourceEndpoints } from "@wso2is/admin.email-templates.v1";
import { getExtendedFeatureResourceEndpoints } from "@wso2is/admin.extensions.v1/configs/endpoints";
import { getFeatureGateResourceEndpoints } from "@wso2is/admin.feature-gate.v1/configs/endpoints";
Expand Down Expand Up @@ -331,7 +329,6 @@ export class Config {
...getCertificatesResourceEndpoints(this.resolveServerHostFromConfig()),
...getIDVPResourceEndpoints(this.resolveServerHost()),
...getEmailTemplatesResourceEndpoints(this.resolveServerHost()),
...getConnectionResourceEndpoints(this.resolveServerHost()),
...getRolesResourceEndpoints(this.resolveServerHost(), this.resolveServerHostFromConfig()),
...getServerConfigurationsResourceEndpoints(this.resolveServerHost()),
...getUsersResourceEndpoints(this.resolveServerHost()),
Expand All @@ -348,7 +345,6 @@ export class Config {
...getInsightsResourceEndpoints(this.resolveServerHostFromConfig()),
...getExtensionTemplatesEndpoints(this.resolveServerHost()),
...getApplicationTemplatesResourcesEndpoints(this.resolveServerHost()),
...getActionsResourceEndpoints(this.resolveServerHost()),
...getRulesEndpoints(this.resolveServerHost()),
...getSmsTemplateResourceEndpoints(this.resolveServerHost()),
...getPolicyAdministrationResourceEndpoints(this.resolveServerHost()),
Expand All @@ -368,9 +364,18 @@ export class Config {
...getVCTemplateEndpoints(this.resolveServerHost()),
...getCustomerDataServiceEndpoints(this.resolveServerHost()),
CORSOrigins: `${ this.resolveServerHostFromConfig() }/api/server/v1/cors/origins`,
actions: "",
asyncStatus: `${ this.resolveServerHost(false, true) }/api/server/v1/async-operations`,
authenticatorTags: "",
authenticators: "",
customAuthenticators: "",
extensions: "",
fidoConfigs: "",
identityProviders: "",
localAuthenticators: "",
// TODO: Remove this endpoint and use ID token to get the details
me: `${ this.getDeploymentConfig()?.serverHost }/scim2/Me`,
multiFactorAuthenticators: "",
saml2Meta: `${ this.resolveServerHost(false, true) }/identity/metadata/saml2`,
wellKnown: `${ this.resolveServerHost(false, true) }/oauth2/token/.well-known/openid-configuration`
};
Expand Down
13 changes: 9 additions & 4 deletions features/admin.core.v1/models/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import { ResponseMode, Storage } from "@asgardeo/auth-react";
import { FeatureAccessConfigInterface } from "@wso2is/access-control";
import { ActionsResourceEndpointsInterface } from "@wso2is/admin.actions.v1/models/endpoints";
import { ApplicationsTemplatesEndpointsInterface } from "@wso2is/admin.application-templates.v1/models/endpoints";
import {
ApplicationTemplateLoadingStrategies
Expand All @@ -32,7 +31,6 @@ import { BrandingPreferenceResourceEndpointsInterface } from "@wso2is/admin.bran
import { CustomerDataServiceEndpointsInterface } from "@wso2is/admin.cds.v1/models/endpoints";
import { CertificatesResourceEndpointsInterface } from "@wso2is/admin.certificates.v1";
import { ClaimResourceEndpointsInterface } from "@wso2is/admin.claims.v1/models/endpoints";
import { ConnectionResourceEndpointsInterface } from "@wso2is/admin.connections.v1";
import { FlowBuilderCoreResourceEndpointsInterface } from "@wso2is/admin.flow-builder-core.v1/models/endpoints";
import { GroupsResourceEndpointsInterface } from "@wso2is/admin.groups.v1/models/endpoints";
import { RemoteLoggingResourceEndpointsInterface } from "@wso2is/admin.logs.v1/models/endpoints";
Expand Down Expand Up @@ -739,7 +737,6 @@ export interface ServiceResourceEndpointsInterface extends ClaimResourceEndpoint
UserstoreResourceEndpointsInterface,
RolesResourceEndpointsInterface,
ApplicationsResourceEndpointsInterface,
ConnectionResourceEndpointsInterface,
ScopesResourceEndpointsInterface,
SecretsManagementEndpoints,
OrganizationResourceEndpointsInterface,
Expand All @@ -750,7 +747,6 @@ export interface ServiceResourceEndpointsInterface extends ClaimResourceEndpoint
ExtensionTemplatesEndpointsInterface,
ApplicationsTemplatesEndpointsInterface,
SMSTemplateResourceEndpointsInterface,
ActionsResourceEndpointsInterface,
PolicyAdministrationEndpointsInterface,
WorkflowsResourceEndpointsInterface,
WorkflowAssociationsResourceEndpointsInterface,
Expand All @@ -759,6 +755,15 @@ export interface ServiceResourceEndpointsInterface extends ClaimResourceEndpoint
RemoteLoggingResourceEndpointsInterface,
FlowBuilderCoreResourceEndpointsInterface {

actions: string;
authenticatorTags: string;
authenticators: string;
customAuthenticators: string;
extensions: string;
fidoConfigs: string;
identityProviders: string;
localAuthenticators: string;
multiFactorAuthenticators: string;
CORSOrigins: string;
// TODO: Remove this endpoint and use ID token to get the details
me: string;
Expand Down
2 changes: 0 additions & 2 deletions features/admin.core.v1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@oxygen-ui/react": "^2.4.6",
"@oxygen-ui/react-icons": "^2.4.6",
"@wso2is/access-control": "^3.5.1",
"@wso2is/admin.actions.v1": "^1.15.1",
"@wso2is/admin.administrators.v1": "^2.29.208",
"@wso2is/admin.agents.v1": "workspace:^",
"@wso2is/admin.api-resources.v1": "^2.25.204",
Expand All @@ -30,7 +29,6 @@
"@wso2is/admin.branding.v1": "^2.32.94",
"@wso2is/admin.certificates.v1": "^2.25.205",
"@wso2is/admin.claims.v1": "^2.30.1",
"@wso2is/admin.connections.v1": "^2.34.12",
"@wso2is/admin.console-settings.v1": "^2.26.6",
"@wso2is/admin.email-and-sms.v1": "^2.25.206",
"@wso2is/admin.email-management.v1": "^2.25.302",
Expand Down
17 changes: 15 additions & 2 deletions features/admin.organizations.v1/components/organization-list.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023-2025, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2026, 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 @@ -21,7 +21,10 @@ import Breadcrumbs from "@oxygen-ui/react/Breadcrumbs";
import Typography from "@oxygen-ui/react/Typography/Typography";
import { BuildingAltIcon, CloneIcon } from "@oxygen-ui/react-icons";
import { Show, useRequiredScopes } from "@wso2is/access-control";
import { getActionsResourceEndpoints } from "@wso2is/admin.actions.v1/configs/endpoints";
import useSignIn from "@wso2is/admin.authentication.v1/hooks/use-sign-in";
import { getConnectionResourceEndpoints } from "@wso2is/admin.connections.v1/configs/endpoints";
import { Config } from "@wso2is/admin.core.v1/configs/app";
import { getEmptyPlaceholderIllustrations } from "@wso2is/admin.core.v1/configs/ui";
import { AppConstants } from "@wso2is/admin.core.v1/constants/app-constants";
import { UIConstants } from "@wso2is/admin.core.v1/constants/ui-constants";
Expand Down Expand Up @@ -305,7 +308,17 @@ export const OrganizationList: FunctionComponent<OrganizationListPropsInterface>
try {
response = await switchOrganization(organization.id);
updateOrganizationSwitchRequestLoadingState(true);
await onSignIn(response, () => null, () => null, () => null);
await onSignIn(
response,
() => null,
() => null,
() => null,
() => ({
...Config.getServiceResourceEndpoints(),
...getActionsResourceEndpoints(Config.resolveServerHost()),
...getConnectionResourceEndpoints(Config.resolveServerHost())
})
);
onListMutate();
history.push(AppConstants.getPaths().get("GETTING_STARTED"));
} catch(e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023-2025, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2026, 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 @@ -18,7 +18,10 @@

import { BasicUserInfo } from "@asgardeo/auth-react";
import { CloneIcon } from "@oxygen-ui/react-icons";
import { getActionsResourceEndpoints } from "@wso2is/admin.actions.v1/configs/endpoints";
import useSignIn from "@wso2is/admin.authentication.v1/hooks/use-sign-in";
import { getConnectionResourceEndpoints } from "@wso2is/admin.connections.v1/configs/endpoints";
import { Config } from "@wso2is/admin.core.v1/configs/app";
import { AppConstants } from "@wso2is/admin.core.v1/constants/app-constants";
import { OrganizationType } from "@wso2is/admin.core.v1/constants/organization-constants";
import { history } from "@wso2is/admin.core.v1/helpers/history";
Expand Down Expand Up @@ -194,7 +197,12 @@ export const OrganizationSwitchBreadcrumb: FunctionComponent<OrganizationSwitchD
window["AppUtils"].updateOrganizationName("");
}
},
() => null
() => null,
() => ({
...Config.getServiceResourceEndpoints(),
...getActionsResourceEndpoints(Config.resolveServerHost()),
...getConnectionResourceEndpoints(Config.resolveServerHost())
})
);

mutateOrganizationBreadCrumbFetchRequest();
Expand Down
1 change: 1 addition & 0 deletions features/admin.organizations.v1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@oxygen-ui/react": "^2.4.6",
"@oxygen-ui/react-icons": "^2.4.6",
"@wso2is/access-control": "^3.3.20",
"@wso2is/admin.actions.v1": "workspace:^",
"@wso2is/admin.applications.v1": "^2.38.11",
"@wso2is/admin.authentication.v1": "^2.25.206",
"@wso2is/admin.connections.v1": "^2.34.8",
Expand Down
Loading
Loading