feat(*): allow to select auth providers + add multiworkspace with subdomain management (#8656)
## Summary Add support for multi-workspace feature and adjust configurations and states accordingly. - Introduced new state isMultiWorkspaceEnabledState. - Updated ClientConfigProviderEffect component to handle multi-workspace. - Modified GraphQL schema and queries to include multi-workspace related configurations. - Adjusted server environment variables and their respective documentation to support multi-workspace toggle. - Updated server-side logic to handle new multi-workspace configurations and conditions.
This commit is contained in:
@ -11,7 +11,6 @@ import { BillingService } from 'src/engine/core-modules/billing/services/billing
|
||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FindAvailableSSOIDPOutput } from 'src/engine/core-modules/sso/dtos/find-available-SSO-IDP.output';
|
||||
import {
|
||||
SSOException,
|
||||
SSOExceptionCode,
|
||||
@ -149,44 +148,6 @@ export class SSOService {
|
||||
};
|
||||
}
|
||||
|
||||
async findAvailableSSOIdentityProviders(email: string) {
|
||||
const user = await this.userRepository.findOne({
|
||||
where: { email },
|
||||
relations: [
|
||||
'workspaces',
|
||||
'workspaces.workspace',
|
||||
'workspaces.workspace.workspaceSSOIdentityProviders',
|
||||
],
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
throw new SSOException('User not found', SSOExceptionCode.USER_NOT_FOUND);
|
||||
}
|
||||
|
||||
return user.workspaces.flatMap((userWorkspace) =>
|
||||
(
|
||||
userWorkspace.workspace
|
||||
.workspaceSSOIdentityProviders as Array<SSOConfiguration>
|
||||
).reduce((acc, identityProvider) => {
|
||||
if (identityProvider.status === 'Inactive') return acc;
|
||||
|
||||
acc.push({
|
||||
id: identityProvider.id,
|
||||
name: identityProvider.name ?? 'Unknown',
|
||||
issuer: identityProvider.issuer,
|
||||
type: identityProvider.type,
|
||||
status: identityProvider.status,
|
||||
workspace: {
|
||||
id: userWorkspace.workspaceId,
|
||||
displayName: userWorkspace.workspace.displayName,
|
||||
},
|
||||
});
|
||||
|
||||
return acc;
|
||||
}, [] as Array<FindAvailableSSOIDPOutput>),
|
||||
);
|
||||
}
|
||||
|
||||
async findSSOIdentityProviderById(identityProviderId?: string) {
|
||||
// if identityProviderId is not provide, typeorm return a random idp instead of undefined
|
||||
if (!identityProviderId) return undefined;
|
||||
|
||||
@ -8,7 +8,6 @@ import { DeleteSsoInput } from 'src/engine/core-modules/sso/dtos/delete-sso.inpu
|
||||
import { DeleteSsoOutput } from 'src/engine/core-modules/sso/dtos/delete-sso.output';
|
||||
import { EditSsoInput } from 'src/engine/core-modules/sso/dtos/edit-sso.input';
|
||||
import { EditSsoOutput } from 'src/engine/core-modules/sso/dtos/edit-sso.output';
|
||||
import { FindAvailableSSOIDPInput } from 'src/engine/core-modules/sso/dtos/find-available-SSO-IDP.input';
|
||||
import { FindAvailableSSOIDPOutput } from 'src/engine/core-modules/sso/dtos/find-available-SSO-IDP.output';
|
||||
import { GetAuthorizationUrlInput } from 'src/engine/core-modules/sso/dtos/get-authorization-url.input';
|
||||
import { GetAuthorizationUrlOutput } from 'src/engine/core-modules/sso/dtos/get-authorization-url.output';
|
||||
@ -39,14 +38,6 @@ export class SSOResolver {
|
||||
);
|
||||
}
|
||||
|
||||
@UseGuards(SSOProviderEnabledGuard)
|
||||
@Mutation(() => [FindAvailableSSOIDPOutput])
|
||||
async findAvailableSSOIdentityProviders(
|
||||
@Args('input') input: FindAvailableSSOIDPInput,
|
||||
): Promise<Array<FindAvailableSSOIDPOutput>> {
|
||||
return this.sSOService.findAvailableSSOIdentityProviders(input.email);
|
||||
}
|
||||
|
||||
@UseGuards(SSOProviderEnabledGuard)
|
||||
@Query(() => [FindAvailableSSOIDPOutput])
|
||||
async listSSOIdentityProvidersByWorkspaceId(
|
||||
|
||||
@ -31,7 +31,7 @@ export enum OIDCResponseType {
|
||||
}
|
||||
|
||||
registerEnumType(IdentityProviderType, {
|
||||
name: 'IdpType',
|
||||
name: 'IdentityProviderType',
|
||||
});
|
||||
|
||||
export enum SSOIdentityProviderStatus {
|
||||
|
||||
Reference in New Issue
Block a user