Skip to content

Commit

Permalink
feat: remove SAML app dev feature guard
Browse files Browse the repository at this point in the history
  • Loading branch information
darcyYe committed Jan 26, 2025
1 parent faf7e3c commit c39491c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
7 changes: 2 additions & 5 deletions packages/console/src/components/Guide/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,13 @@ export const useAppGuideMetadata = (): {
/**
* Show SAML guides when it is:
* 1. Cloud env
* 2. `isDevFeatureEnabled` is true
* 3. `quota.samlApplicationsLimit` is not 0.
* 2. `quota.samlApplicationsLimit` is not 0.
*/
)
.filter(
({ metadata: { target } }) =>
target !== ApplicationType.SAML ||
(isCloudEnv &&
isDevFeaturesEnabled &&
currentSubscriptionQuota.samlApplicationsLimit !== 0)
(isCloudEnv && currentSubscriptionQuota.samlApplicationsLimit !== 0)
),
[]

Check warning on line 58 in packages/console/src/components/Guide/hooks.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/console/src/components/Guide/hooks.ts#L58

[react-hooks/exhaustive-deps] React Hook useMemo has a missing dependency: 'currentSubscriptionQuota.samlApplicationsLimit'. Either include it or remove the dependency array.
);
Expand Down
8 changes: 3 additions & 5 deletions packages/core/src/routes/applications/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { generateStandardId, generateStandardSecret } from '@logto/shared';
import { conditional } from '@silverhand/essentials';
import { boolean, object, string, z } from 'zod';

import { EnvSet } from '#src/env-set/index.js';
import RequestError from '#src/errors/RequestError/index.js';
import koaGuard from '#src/middleware/koa-guard.js';
import koaPagination from '#src/middleware/koa-pagination.js';
Expand Down Expand Up @@ -42,10 +41,9 @@ const hideOidcClientMetadataForSamlApp = (application: Application) => {
return {
...application,
...conditional(
application.type === ApplicationType.SAML &&
EnvSet.values.isDevFeaturesEnabled && {
oidcClientMetadata: buildOidcClientMetadata(),
}
application.type === ApplicationType.SAML && {
oidcClientMetadata: buildOidcClientMetadata(),
}

Check warning on line 46 in packages/core/src/routes/applications/application.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/routes/applications/application.ts#L45-L46

Added lines #L45 - L46 were not covered by tests
),
};
};
Expand Down
12 changes: 2 additions & 10 deletions packages/core/src/routes/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ const createRouters = (tenant: TenantContext) => {
systemRoutes(managementRouter, tenant);
subjectTokenRoutes(managementRouter, tenant);
accountCentersRoutes(managementRouter, tenant);
// TODO: @darcy per our design, we will move related routes to Cloud repo and the routes will be loaded from remote.
if (
(EnvSet.values.isDevFeaturesEnabled && EnvSet.values.isCloud) ||
EnvSet.values.isIntegrationTest
) {
if (EnvSet.values.isCloud || EnvSet.values.isIntegrationTest) {
samlApplicationRoutes(managementRouter, tenant);
}

Expand All @@ -121,11 +117,7 @@ const createRouters = (tenant: TenantContext) => {
wellKnownRoutes(anonymousRouter, tenant);
statusRoutes(anonymousRouter, tenant);
authnRoutes(anonymousRouter, tenant);
// TODO: @darcy per our design, we will move related routes to Cloud repo and the routes will be loaded from remote.
if (
(EnvSet.values.isDevFeaturesEnabled && EnvSet.values.isCloud) ||
EnvSet.values.isIntegrationTest
) {
if (EnvSet.values.isCloud || EnvSet.values.isIntegrationTest) {
samlApplicationAnonymousRoutes(anonymousRouter, tenant);
}

Expand Down

0 comments on commit c39491c

Please sign in to comment.