mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
chore(core): add dev feature guard to SSO endpoints (#4971)
* chore(core): guard sso api guard sso api * chore(core): guard sso interaction api guard sso interaction api
This commit is contained in:
parent
528c6c462c
commit
ccfad51e62
2 changed files with 12 additions and 0 deletions
|
@ -3,6 +3,7 @@ import type Router from 'koa-router';
|
||||||
import { type IRouterParamContext } from 'koa-router';
|
import { type IRouterParamContext } from 'koa-router';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
import { EnvSet } from '#src/env-set/index.js';
|
||||||
import RequestError from '#src/errors/RequestError/index.js';
|
import RequestError from '#src/errors/RequestError/index.js';
|
||||||
import { assignInteractionResults } from '#src/libraries/session.js';
|
import { assignInteractionResults } from '#src/libraries/session.js';
|
||||||
import { type WithLogContext } from '#src/middleware/koa-audit-log.js';
|
import { type WithLogContext } from '#src/middleware/koa-audit-log.js';
|
||||||
|
@ -28,6 +29,11 @@ export default function singleSignOnRoutes<T extends IRouterParamContext>(
|
||||||
router: Router<unknown, WithInteractionDetailsContext<WithLogContext<T>>>,
|
router: Router<unknown, WithInteractionDetailsContext<WithLogContext<T>>>,
|
||||||
tenant: TenantContext
|
tenant: TenantContext
|
||||||
) {
|
) {
|
||||||
|
// FIXME: @simeng-li should remove this check after the feature is enabled in production
|
||||||
|
if (!EnvSet.values.isDevFeaturesEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { provider, libraries, queries } = tenant;
|
const { provider, libraries, queries } = tenant;
|
||||||
|
|
||||||
const { ssoConnectors: ssoConnectorsLibrary } = libraries;
|
const { ssoConnectors: ssoConnectorsLibrary } = libraries;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { generateStandardShortId } from '@logto/shared';
|
||||||
import { conditional, assert } from '@silverhand/essentials';
|
import { conditional, assert } from '@silverhand/essentials';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
import { EnvSet } from '#src/env-set/index.js';
|
||||||
import RequestError from '#src/errors/RequestError/index.js';
|
import RequestError from '#src/errors/RequestError/index.js';
|
||||||
import koaGuard from '#src/middleware/koa-guard.js';
|
import koaGuard from '#src/middleware/koa-guard.js';
|
||||||
import koaPagination from '#src/middleware/koa-pagination.js';
|
import koaPagination from '#src/middleware/koa-pagination.js';
|
||||||
|
@ -26,6 +27,11 @@ import {
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
|
|
||||||
export default function singleSignOnRoutes<T extends AuthedRouter>(...args: RouterInitArgs<T>) {
|
export default function singleSignOnRoutes<T extends AuthedRouter>(...args: RouterInitArgs<T>) {
|
||||||
|
// FIXME: @simeng-li should remove this check after the feature is enabled in production
|
||||||
|
if (!EnvSet.values.isDevFeaturesEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const [
|
const [
|
||||||
router,
|
router,
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue