mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor: update dependency on @logto/cloud and update legacy JWT customizer
This commit is contained in:
parent
316c11128a
commit
de70abebf6
7 changed files with 18 additions and 27 deletions
|
@ -48,6 +48,6 @@
|
|||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@logto/cloud": "0.2.5-6c090b2"
|
||||
"@logto/cloud": "0.2.5-1807f9c"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"@fontsource/roboto-mono": "^5.0.0",
|
||||
"@jest/types": "^29.5.0",
|
||||
"@logto/app-insights": "workspace:^1.4.0",
|
||||
"@logto/cloud": "0.2.5-6c090b2",
|
||||
"@logto/cloud": "0.2.5-1807f9c",
|
||||
"@logto/connector-kit": "workspace:^2.1.0",
|
||||
"@logto/core-kit": "workspace:^2.3.0",
|
||||
"@logto/language-kit": "workspace:^1.1.0",
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
"zod": "^3.22.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@logto/cloud": "0.2.5-6c090b2",
|
||||
"@logto/cloud": "0.2.5-1807f9c",
|
||||
"@silverhand/eslint-config": "5.0.0",
|
||||
"@silverhand/ts-config": "5.0.0",
|
||||
"@types/debug": "^4.1.7",
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
type Json,
|
||||
jwtCustomizer as jwtCustomizerLog,
|
||||
LogResult,
|
||||
LogtoJwtTokenPath,
|
||||
LogtoJwtTokenKeyType,
|
||||
} from '@logto/schemas';
|
||||
import { generateStandardId } from '@logto/shared';
|
||||
import { conditional, trySafe, tryThat } from '@silverhand/essentials';
|
||||
|
@ -269,13 +269,11 @@ export default function initOidc(
|
|||
body: isTokenClientCredentials
|
||||
? {
|
||||
...commonPayload,
|
||||
// TODO: update once cloud repo is ready.
|
||||
tokenType: LogtoJwtTokenPath.ClientCredentials,
|
||||
tokenType: LogtoJwtTokenKeyType.ClientCredentials,
|
||||
}
|
||||
: {
|
||||
...commonPayload,
|
||||
// TODO: update once cloud repo is ready.
|
||||
tokenType: LogtoJwtTokenPath.AccessToken,
|
||||
tokenType: LogtoJwtTokenKeyType.AccessToken,
|
||||
// TODO (LOG-8555): the newly added `UserProfile` type includes undefined fields and can not be directly assigned to `Json` type. And the `undefined` fields should be removed by zod guard.
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
context: { user: logtoUserInfo as Record<string, Json> },
|
||||
|
|
|
@ -7,8 +7,6 @@ import {
|
|||
adminTenantId,
|
||||
jwtCustomizerConfigsGuard,
|
||||
jwtCustomizerTestRequestBodyGuard,
|
||||
type CustomJwtFetcher,
|
||||
type LogtoJwtTokenPath,
|
||||
} from '@logto/schemas';
|
||||
import { ResponseError } from '@withtyped/client';
|
||||
import { ZodError, z } from 'zod';
|
||||
|
@ -191,9 +189,7 @@ export default function logtoConfigJwtCustomizerRoutes<T extends AuthedRouter>(
|
|||
|
||||
try {
|
||||
ctx.body = await client.post(`/api/services/custom-jwt`, {
|
||||
// TODO: remove type casting once the cloud repo is updated.
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
body: body as CustomJwtFetcher & { tokenType: LogtoJwtTokenPath },
|
||||
body,
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
/**
|
||||
|
|
|
@ -59,12 +59,6 @@ export const clientCredentialsJwtCustomizerGuard = jwtCustomizerGuard
|
|||
|
||||
export type ClientCredentialsJwtCustomizer = z.infer<typeof clientCredentialsJwtCustomizerGuard>;
|
||||
|
||||
// TODO: Temporarily leave this and will remove it after the cloud repo is updated.
|
||||
export enum LogtoJwtTokenPath {
|
||||
AccessToken = 'access-token',
|
||||
ClientCredentials = 'client-credentials',
|
||||
}
|
||||
|
||||
export enum LogtoJwtTokenKeyType {
|
||||
AccessToken = 'access-token',
|
||||
ClientCredentials = 'client-credentials',
|
||||
|
|
|
@ -1235,8 +1235,8 @@ importers:
|
|||
version: 3.22.4
|
||||
devDependencies:
|
||||
'@logto/cloud':
|
||||
specifier: 0.2.5-6c090b2
|
||||
version: 0.2.5-6c090b2(zod@3.22.4)
|
||||
specifier: 0.2.5-1807f9c
|
||||
version: 0.2.5-1807f9c(zod@3.22.4)
|
||||
'@rollup/plugin-commonjs':
|
||||
specifier: ^25.0.0
|
||||
version: 25.0.7(rollup@4.12.0)
|
||||
|
@ -2715,8 +2715,8 @@ importers:
|
|||
specifier: workspace:^1.4.0
|
||||
version: link:../app-insights
|
||||
'@logto/cloud':
|
||||
specifier: 0.2.5-6c090b2
|
||||
version: 0.2.5-6c090b2(zod@3.22.4)
|
||||
specifier: 0.2.5-1807f9c
|
||||
version: 0.2.5-1807f9c(zod@3.22.4)
|
||||
'@logto/connector-kit':
|
||||
specifier: workspace:^2.1.0
|
||||
version: link:../toolkit/connector-kit
|
||||
|
@ -3202,8 +3202,8 @@ importers:
|
|||
version: 3.22.4
|
||||
devDependencies:
|
||||
'@logto/cloud':
|
||||
specifier: 0.2.5-6c090b2
|
||||
version: 0.2.5-6c090b2(zod@3.22.4)
|
||||
specifier: 0.2.5-1807f9c
|
||||
version: 0.2.5-1807f9c(zod@3.22.4)
|
||||
'@silverhand/eslint-config':
|
||||
specifier: 5.0.0
|
||||
version: 5.0.0(eslint@8.44.0)(prettier@3.0.0)(typescript@5.3.3)
|
||||
|
@ -7644,8 +7644,8 @@ packages:
|
|||
jose: 5.2.2
|
||||
dev: true
|
||||
|
||||
/@logto/cloud@0.2.5-6c090b2(zod@3.22.4):
|
||||
resolution: {integrity: sha512-hyPwnd3endAlvW3/55zde2g2hUFGDbHMswh1HqIQoizBikgdI1KjZL9YF/kfTGAOr8AYHJQOYOpphWNcNQ1AZQ==}
|
||||
/@logto/cloud@0.2.5-1807f9c(zod@3.22.4):
|
||||
resolution: {integrity: sha512-npHrIjd7l90rCEx4G6RHR0Xu4d7X1JPeGjGpfyLjPttx4MTMHHOZS/8GtsXDdrFKRioZUsAymvNfjhNKq/XoQg==}
|
||||
engines: {node: ^20.9.0}
|
||||
dependencies:
|
||||
'@silverhand/essentials': 2.9.0
|
||||
|
@ -17988,6 +17988,9 @@ packages:
|
|||
resolution: {integrity: sha512-2GTVocFkwblV/TIg9AmT7TI2fO4xdWkyN8aFUEVtiVNWt96GTR3FgQyHFValfCbcj1k9Xf962Ws2hYXYUr9k1Q==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
hasBin: true
|
||||
peerDependenciesMeta:
|
||||
'@parcel/core':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@parcel/config-default': 2.9.3(@parcel/core@2.9.3)(postcss@8.4.31)
|
||||
'@parcel/core': 2.9.3
|
||||
|
|
Loading…
Reference in a new issue