Skip to content
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

feat: remove SAML app dev feature guard #6983

Merged
merged 1 commit into from
Jan 27, 2025
Merged
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: 2 additions & 5 deletions packages/console/src/components/Guide/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,15 @@
/**
* 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.
);

const getFilteredAppGuideMetadata = useCallback(
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
@@ -1,4 +1,4 @@
// TODO: @darcyYe refactor this file later to remove disable max line comment

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

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/core/src/routes/applications/application.ts#L1

[no-warning-comments] Unexpected 'todo' comment: 'TODO: @darcyYe refactor this file later...'.
/* eslint-disable max-lines */
import type { Role, Application } from '@logto/schemas';
import {
Expand All @@ -13,7 +13,6 @@
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 @@
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 @@ -69,7 +69,7 @@
managementRouter.use(koaTenantGuard(tenant.id, tenant.queries));
managementRouter.use(koaManagementApiHooks(tenant.libraries.hooks));

// TODO: FIXME @sijie @darcy mount these routes in `applicationRoutes` instead

Check warning on line 72 in packages/core/src/routes/init.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/core/src/routes/init.ts#L72

[no-warning-comments] Unexpected 'todo' comment: 'TODO: FIXME @sijie @darcy mount these...'.
applicationRoutes(managementRouter, tenant);
applicationRoleRoutes(managementRouter, tenant);
applicationProtectedAppMetadataRoutes(managementRouter, tenant);
Expand Down Expand Up @@ -101,11 +101,7 @@
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 @@ -113,7 +109,7 @@

const userRouter: UserRouter = new Router();
userRouter.use(koaOidcAuth(tenant));
// TODO(LOG-10147): Rename to koaApiHooks, this middleware is used for both management API and user API

Check warning on line 112 in packages/core/src/routes/init.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/core/src/routes/init.ts#L112

[no-warning-comments] Unexpected 'todo' comment: 'TODO(LOG-10147): Rename to koaApiHooks,...'.
userRouter.use(koaManagementApiHooks(tenant.libraries.hooks));
accountRoutes(userRouter, tenant);
verificationRoutes(userRouter, tenant);
Expand All @@ -121,11 +117,7 @@
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 All @@ -141,7 +133,7 @@
anonymousRouter,
experienceRouter,
userRouter,
// TODO: interactionRouter should be removed from swagger.json

Check warning on line 136 in packages/core/src/routes/init.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/core/src/routes/init.ts#L136

[no-warning-comments] Unexpected 'todo' comment: 'TODO: interactionRouter should be...'.
interactionRouter,
]);

Expand Down
Loading