[refactor]: Remove isSSOEnabled logic throughout the codebase (#9462)
Eliminated all references to `isSSOEnabled` across the frontend, backend, and configuration files. This change simplifies the codebase by removing unnecessary feature flag checks, associated logic, and environment variables. The SSO feature remains available without reliance on this flag.
This commit is contained in:
@ -65,9 +65,6 @@ export class ClientConfig {
|
||||
@Field(() => Boolean)
|
||||
isMultiWorkspaceEnabled: boolean;
|
||||
|
||||
@Field(() => Boolean)
|
||||
isSSOEnabled: boolean;
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
defaultSubdomain: string;
|
||||
|
||||
|
||||
@ -29,7 +29,6 @@ export class ClientConfigResolver {
|
||||
microsoft: this.environmentService.get('AUTH_MICROSOFT_ENABLED'),
|
||||
sso: [],
|
||||
},
|
||||
isSSOEnabled: this.environmentService.get('AUTH_SSO_ENABLED'),
|
||||
signInPrefilled: this.environmentService.get('SIGN_IN_PREFILLED'),
|
||||
isMultiWorkspaceEnabled: this.environmentService.get(
|
||||
'IS_MULTIWORKSPACE_ENABLED',
|
||||
|
||||
@ -24,7 +24,6 @@ import { LLMTracingDriver } from 'src/engine/core-modules/llm-tracing/interfaces
|
||||
|
||||
import { CacheStorageType } from 'src/engine/core-modules/cache-storage/types/cache-storage-type.enum';
|
||||
import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces';
|
||||
import { AssertOrWarn } from 'src/engine/core-modules/environment/decorators/assert-or-warn.decorator';
|
||||
import { CastToBoolean } from 'src/engine/core-modules/environment/decorators/cast-to-boolean.decorator';
|
||||
import { CastToLogLevelArray } from 'src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator';
|
||||
import { CastToPositiveNumber } from 'src/engine/core-modules/environment/decorators/cast-to-positive-number.decorator';
|
||||
@ -232,11 +231,6 @@ export class EnvironmentVariables {
|
||||
@ValidateIf((env) => env.AUTH_GOOGLE_ENABLED)
|
||||
AUTH_GOOGLE_CALLBACK_URL: string;
|
||||
|
||||
@CastToBoolean()
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
AUTH_SSO_ENABLED = false;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
ENTERPRISE_KEY: string;
|
||||
@ -459,16 +453,6 @@ export class EnvironmentVariables {
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@AssertOrWarn(
|
||||
(env, value) =>
|
||||
!env.AUTH_SSO_ENABLED ||
|
||||
(env.AUTH_SSO_ENABLED &&
|
||||
value !== 'replace_me_with_a_random_string_session'),
|
||||
{
|
||||
message:
|
||||
'SESSION_STORE_SECRET should be changed to a secure, random string.',
|
||||
},
|
||||
)
|
||||
SESSION_STORE_SECRET = 'replace_me_with_a_random_string_session';
|
||||
|
||||
@CastToBoolean()
|
||||
|
||||
@ -7,7 +7,6 @@ export enum FeatureFlagKey {
|
||||
IsFreeAccessEnabled = 'IS_FREE_ACCESS_ENABLED',
|
||||
IsFunctionSettingsEnabled = 'IS_FUNCTION_SETTINGS_ENABLED',
|
||||
IsWorkflowEnabled = 'IS_WORKFLOW_ENABLED',
|
||||
IsSSOEnabled = 'IS_SSO_ENABLED',
|
||||
IsGmailSendEmailScopeEnabled = 'IS_GMAIL_SEND_EMAIL_SCOPE_ENABLED',
|
||||
IsAnalyticsV2Enabled = 'IS_ANALYTICS_V2_ENABLED',
|
||||
IsUniqueIndexesEnabled = 'IS_UNIQUE_INDEXES_ENABLED',
|
||||
|
||||
@ -9,8 +9,6 @@ import { Repository } from 'typeorm';
|
||||
import { BillingEntitlementKey } from 'src/engine/core-modules/billing/enums/billing-entitlement-key.enum';
|
||||
import { BillingService } from 'src/engine/core-modules/billing/services/billing.service';
|
||||
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 {
|
||||
SSOException,
|
||||
SSOExceptionCode,
|
||||
@ -30,8 +28,6 @@ import {
|
||||
export class SSOService {
|
||||
private readonly featureLookUpKey = BillingEntitlementKey.SSO;
|
||||
constructor(
|
||||
@InjectRepository(FeatureFlagEntity, 'core')
|
||||
private readonly featureFlagRepository: Repository<FeatureFlagEntity>,
|
||||
@InjectRepository(WorkspaceSSOIdentityProvider, 'core')
|
||||
private readonly workspaceSSOIdentityProviderRepository: Repository<WorkspaceSSOIdentityProvider>,
|
||||
private readonly environmentService: EnvironmentService,
|
||||
@ -39,18 +35,6 @@ export class SSOService {
|
||||
) {}
|
||||
|
||||
private async isSSOEnabled(workspaceId: string) {
|
||||
const isSSOEnabledFeatureFlag = await this.featureFlagRepository.findOneBy({
|
||||
workspaceId,
|
||||
key: FeatureFlagKey.IsSSOEnabled,
|
||||
value: true,
|
||||
});
|
||||
|
||||
if (!isSSOEnabledFeatureFlag?.value) {
|
||||
throw new SSOException(
|
||||
`${FeatureFlagKey.IsSSOEnabled} feature flag is disabled`,
|
||||
SSOExceptionCode.SSO_DISABLE,
|
||||
);
|
||||
}
|
||||
const isSSOBillingEnabled =
|
||||
await this.billingService.hasWorkspaceActiveSubscriptionOrFreeAccessOrEntitlement(
|
||||
workspaceId,
|
||||
@ -59,7 +43,7 @@ export class SSOService {
|
||||
|
||||
if (!isSSOBillingEnabled) {
|
||||
throw new SSOException(
|
||||
`${FeatureFlagKey.IsSSOEnabled} feature is enabled but no entitlement for this workspace`,
|
||||
`No entitlement found for this workspace`,
|
||||
SSOExceptionCode.SSO_DISABLE,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user