-
Notifications
You must be signed in to change notification settings - Fork 267
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
Add pre auth and tenant switch improvement for central deployment related authentication #7291
base: master
Are you sure you want to change the base?
Changes from all commits
c55f9d4
4c8500e
d7a30c1
f7aa916
97a839a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
"@wso2is/admin.tenants.v1": minor | ||
"@wso2is/admin.administration.v1": minor | ||
"@wso2is/admin.base.v1": minor | ||
"@wso2is/admin.core.v1": minor | ||
"@wso2is/myaccount": minor | ||
"@wso2is/console": minor | ||
"@wso2is/core": minor | ||
"@wso2is/i18n": minor | ||
--- | ||
|
||
Introduce deployment units to tenant dropdown and tenant creation. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -121,6 +121,7 @@ export class Config { | |||||
appHomePath: window[ "AppUtils" ]?.getConfig()?.routes?.home, | ||||||
appLoginPath: window[ "AppUtils" ]?.getConfig()?.routes?.login, | ||||||
appLogoutPath: window[ "AppUtils" ]?.getConfig()?.routes?.logout, | ||||||
centralDeploymentEnabled: window[ "AppUtils" ]?.getConfig()?.routes?.centralDeploymentEnabled, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In getconfig function in console/src/init/app-utils, this value is returned in the config object as a first level property, not as a nested property of routes object. So ideally the config value should be taken as follows.
Suggested change
|
||||||
clientHost: window[ "AppUtils" ]?.getConfig()?.clientOriginWithTenant, | ||||||
clientID: window[ "AppUtils" ]?.getConfig()?.clientID, | ||||||
clientOrigin: window[ "AppUtils" ]?.getConfig()?.clientOrigin, | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ import { store } from "@wso2is/admin.core.v1/store"; | |
import { OrganizationType } from "@wso2is/admin.organizations.v1/constants"; | ||
import { HttpMethods } from "@wso2is/core/models"; | ||
import { AxiosError, AxiosRequestConfig, AxiosResponse } from "axios"; | ||
import { TenantRequestResponse } from "../models"; | ||
import { DeploymentUnit, DeploymentUnitResponse, TenantRequestResponse } from "../models"; | ||
|
||
const getDomainQueryParam = (): string => { | ||
const tenantDomain: string = store.getState().auth.tenantDomain; | ||
|
@@ -47,9 +47,10 @@ const httpClient: HttpClientInstance = AsgardeoSPAClient.getInstance() | |
* | ||
* @param tenantName - new tenant name | ||
*/ | ||
export const addNewTenant = (tenantName: string): Promise<AxiosResponse> => { | ||
export const addNewTenant = (tenantName: string, deploymentUnit?: DeploymentUnit): Promise<AxiosResponse> => { | ||
const requestConfig: AxiosRequestConfig = { | ||
data: { | ||
deploymentUnit: deploymentUnit?.name, | ||
domain: tenantName | ||
}, | ||
headers: { | ||
|
@@ -160,3 +161,25 @@ export const getAssociatedTenants = ( | |
return Promise.reject(error?.response?.data); | ||
}); | ||
}; | ||
|
||
/** | ||
* Get the deployment units. | ||
* | ||
* @returns - A promise that resolves with the Deployment response object. | ||
*/ | ||
export const getDeploymentUnits = ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we use SWR for http get requests. Therefore, shall we refactor this method to a separate hook that utilize useRequest hook? |
||
): Promise<DeploymentUnitResponse> => { | ||
|
||
const requestConfig: AxiosRequestConfig = { | ||
method: HttpMethods.GET, | ||
url: store.getState().config.endpoints.deploymentUnit + getDomainQueryParam() | ||
}; | ||
|
||
return httpClient(requestConfig) | ||
.then((response: AxiosResponse) => { | ||
return Promise.resolve(response?.data); | ||
}) | ||
.catch((error: AxiosError) => { | ||
return Promise.reject(error?.response?.data); | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no changes to this administrators package in this pr, hence we can remove it I guess.