0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

feat(connector,console,core): add SSO paywall for core management APIs (#5024)

This commit is contained in:
Darcy Ye 2023-12-01 16:27:01 +08:00 committed by GitHub
parent 997a0036d8
commit 88285ba7b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 11 deletions

View file

@ -49,6 +49,6 @@
"access": "public" "access": "public"
}, },
"devDependencies": { "devDependencies": {
"@logto/cloud": "0.2.5-9257c0d" "@logto/cloud": "0.2.5-5a698db"
} }
} }

View file

@ -26,7 +26,7 @@
"@fontsource/roboto-mono": "^5.0.0", "@fontsource/roboto-mono": "^5.0.0",
"@jest/types": "^29.5.0", "@jest/types": "^29.5.0",
"@logto/app-insights": "workspace:^1.3.1", "@logto/app-insights": "workspace:^1.3.1",
"@logto/cloud": "0.2.5-9257c0d", "@logto/cloud": "0.2.5-5a698db",
"@logto/connector-kit": "workspace:^2.0.0", "@logto/connector-kit": "workspace:^2.0.0",
"@logto/core-kit": "workspace:^2.1.2", "@logto/core-kit": "workspace:^2.1.2",
"@logto/language-kit": "workspace:^1.0.0", "@logto/language-kit": "workspace:^1.0.0",

View file

@ -91,7 +91,7 @@
"zod": "^3.22.4" "zod": "^3.22.4"
}, },
"devDependencies": { "devDependencies": {
"@logto/cloud": "0.2.5-9257c0d", "@logto/cloud": "0.2.5-5a698db",
"@silverhand/eslint-config": "4.0.1", "@silverhand/eslint-config": "4.0.1",
"@silverhand/ts-config": "4.0.0", "@silverhand/ts-config": "4.0.0",
"@types/debug": "^4.1.7", "@types/debug": "^4.1.7",

View file

@ -71,6 +71,7 @@ export const createQuotaLibrary = (
customDomainEnabled: notNumber, customDomainEnabled: notNumber,
mfaEnabled: notNumber, mfaEnabled: notNumber,
organizationsEnabled: notNumber, organizationsEnabled: notNumber,
ssoEnabled: notNumber,
omniSignInEnabled: notNumber, // No limit for now omniSignInEnabled: notNumber, // No limit for now
builtInEmailConnectorEnabled: notNumber, // No limit for now builtInEmailConnectorEnabled: notNumber, // No limit for now
}; };

View file

@ -12,6 +12,7 @@ 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';
import koaQuotaGuard from '#src/middleware/koa-quota-guard.js';
import { ssoConnectorCreateGuard, ssoConnectorPatchGuard } from '#src/routes/sso-connector/type.js'; import { ssoConnectorCreateGuard, ssoConnectorPatchGuard } from '#src/routes/sso-connector/type.js';
import { ssoConnectorFactories, standardSsoConnectorProviders } from '#src/sso/index.js'; import { ssoConnectorFactories, standardSsoConnectorProviders } from '#src/sso/index.js';
import { isSupportedSsoProvider, isSupportedSsoConnector } from '#src/sso/utils.js'; import { isSupportedSsoProvider, isSupportedSsoConnector } from '#src/sso/utils.js';
@ -40,11 +41,14 @@ export default function singleSignOnRoutes<T extends AuthedRouter>(...args: Rout
id: tenantId, id: tenantId,
queries: { ssoConnectors }, queries: { ssoConnectors },
libraries: { libraries: {
quota,
ssoConnectors: { getSsoConnectorById, getSsoConnectors }, ssoConnectors: { getSsoConnectorById, getSsoConnectors },
}, },
}, },
] = args; ] = args;
router.use(koaQuotaGuard({ key: 'ssoEnabled', quota, methods: ['POST', 'PUT'] }));
const pathname = `/${tableToPathname(SsoConnectors.table)}`; const pathname = `/${tableToPathname(SsoConnectors.table)}`;
/* /*

View file

@ -1322,8 +1322,8 @@ importers:
specifier: ^29.5.0 specifier: ^29.5.0
version: 29.5.0 version: 29.5.0
'@logto/cloud': '@logto/cloud':
specifier: 0.2.5-9257c0d specifier: 0.2.5-5a698db
version: 0.2.5-9257c0d(zod@3.22.4) version: 0.2.5-5a698db(zod@3.22.4)
'@rollup/plugin-commonjs': '@rollup/plugin-commonjs':
specifier: ^25.0.0 specifier: ^25.0.0
version: 25.0.7(rollup@4.1.4) version: 25.0.7(rollup@4.1.4)
@ -2840,8 +2840,8 @@ importers:
specifier: workspace:^1.3.1 specifier: workspace:^1.3.1
version: link:../app-insights version: link:../app-insights
'@logto/cloud': '@logto/cloud':
specifier: 0.2.5-9257c0d specifier: 0.2.5-5a698db
version: 0.2.5-9257c0d(zod@3.22.4) version: 0.2.5-5a698db(zod@3.22.4)
'@logto/connector-kit': '@logto/connector-kit':
specifier: workspace:^2.0.0 specifier: workspace:^2.0.0
version: link:../toolkit/connector-kit version: link:../toolkit/connector-kit
@ -3318,8 +3318,8 @@ importers:
version: 3.22.4 version: 3.22.4
devDependencies: devDependencies:
'@logto/cloud': '@logto/cloud':
specifier: 0.2.5-9257c0d specifier: 0.2.5-5a698db
version: 0.2.5-9257c0d(zod@3.22.4) version: 0.2.5-5a698db(zod@3.22.4)
'@silverhand/eslint-config': '@silverhand/eslint-config':
specifier: 4.0.1 specifier: 4.0.1
version: 4.0.1(eslint@8.44.0)(prettier@3.0.0)(typescript@5.0.2) version: 4.0.1(eslint@8.44.0)(prettier@3.0.0)(typescript@5.0.2)
@ -7519,8 +7519,8 @@ packages:
jose: 4.14.4 jose: 4.14.4
dev: true dev: true
/@logto/cloud@0.2.5-9257c0d(zod@3.22.4): /@logto/cloud@0.2.5-5a698db(zod@3.22.4):
resolution: {integrity: sha512-tACUnAH8eRVS/InlIFIP50IcQzjlqCCPPa2Oqs4NNe1EkVMW7uplNZDPa1cTqT3fk223OvU9/9f0ydK9gwNZPQ==} resolution: {integrity: sha512-khGNmCJgUBQCpIxsewsoeaPHDtR5FgX03SSAYfaPJATxvMS8j+B0BeGP6J2OTsH5iB86K6dJ4BJwKlB2cweY4g==}
engines: {node: ^18.12.0} engines: {node: ^18.12.0}
dependencies: dependencies:
'@silverhand/essentials': 2.8.5 '@silverhand/essentials': 2.8.5