mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): replace ts with js for JWT customizer (#5760)
replace ts with js for JWT customizer
This commit is contained in:
parent
9707d66930
commit
15e543abc0
2 changed files with 11 additions and 7 deletions
|
@ -98,10 +98,17 @@ function MonacoCodeEditor({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeModel.language === 'typescript') {
|
if (activeModel.language === 'typescript') {
|
||||||
|
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
||||||
|
noSemanticValidation: false,
|
||||||
|
noSyntaxValidation: false,
|
||||||
|
});
|
||||||
|
|
||||||
// Set the typescript compiler options
|
// Set the typescript compiler options
|
||||||
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
|
||||||
allowNonTsExtensions: true,
|
allowNonTsExtensions: true,
|
||||||
strictNullChecks: true,
|
strictNullChecks: true,
|
||||||
|
allowJs: true,
|
||||||
|
checkJs: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [activeModel, monaco, environmentVariablesDefinition]);
|
}, [activeModel, monaco, environmentVariablesDefinition]);
|
||||||
|
|
|
@ -47,15 +47,13 @@ export const defaultAccessTokenJwtCustomizerCode = `/**
|
||||||
* This function is called during the access token generation process to get custom claims for the JWT token.
|
* This function is called during the access token generation process to get custom claims for the JWT token.
|
||||||
* Limit custom claims to under 50KB.
|
* Limit custom claims to under 50KB.
|
||||||
*
|
*
|
||||||
* @param {Payload} payload - The input payload of the function.
|
* @param {Object} payload - The input payload of the function.
|
||||||
* @param {${JwtCustomizerTypeDefinitionKey.AccessTokenPayload}} payload.token -The JWT token.
|
* @param {${JwtCustomizerTypeDefinitionKey.AccessTokenPayload}} payload.token -The JWT token.
|
||||||
* @param {Context} payload.context - Logto internal data that can be used to pass additional information
|
* @param {Context} payload.context - Logto internal data that can be used to pass additional information
|
||||||
* @param {${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserContext}} payload.context.user - The user info associated with the token.
|
|
||||||
* @param {${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}} [payload.environmentVariables] - The environment variables.
|
* @param {${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}} [payload.environmentVariables] - The environment variables.
|
||||||
*
|
*
|
||||||
* @returns The custom claims.
|
* @returns The custom claims.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const getCustomJwtClaims = async ({ token, context, environmentVariables }) => {
|
const getCustomJwtClaims = async ({ token, context, environmentVariables }) => {
|
||||||
return {};
|
return {};
|
||||||
}`;
|
}`;
|
||||||
|
@ -64,19 +62,18 @@ export const defaultClientCredentialsJwtCustomizerCode = `/**
|
||||||
* This function is called during the access token generation process to get custom claims for the JWT token.
|
* This function is called during the access token generation process to get custom claims for the JWT token.
|
||||||
* Limit custom claims to under 50KB.
|
* Limit custom claims to under 50KB.
|
||||||
*
|
*
|
||||||
* @param {Payload} payload - The input payload of the function.
|
* @param {Object} payload - The input payload of the function.
|
||||||
* @param {${JwtCustomizerTypeDefinitionKey.ClientCredentialsPayload}} payload.token -The JWT token.
|
* @param {${JwtCustomizerTypeDefinitionKey.ClientCredentialsPayload}} payload.token -The JWT token.
|
||||||
* @param {${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}} [payload.environmentVariables] - The environment variables.
|
* @param {${JwtCustomizerTypeDefinitionKey.EnvironmentVariables}} [payload.environmentVariables] - The environment variables.
|
||||||
*
|
*
|
||||||
* @returns The custom claims.
|
* @returns The custom claims.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const getCustomJwtClaims = async ({ token, environmentVariables }) => {
|
const getCustomJwtClaims = async ({ token, environmentVariables }) => {
|
||||||
return {};
|
return {};
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
export const accessTokenJwtCustomizerModel: ModelSettings = {
|
export const accessTokenJwtCustomizerModel: ModelSettings = {
|
||||||
name: 'user-jwt.ts',
|
name: 'user-jwt.js',
|
||||||
title: 'User access token',
|
title: 'User access token',
|
||||||
language: 'typescript',
|
language: 'typescript',
|
||||||
defaultValue: defaultAccessTokenJwtCustomizerCode,
|
defaultValue: defaultAccessTokenJwtCustomizerCode,
|
||||||
|
@ -93,7 +90,7 @@ export const accessTokenJwtCustomizerModel: ModelSettings = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const clientCredentialsModel: ModelSettings = {
|
export const clientCredentialsModel: ModelSettings = {
|
||||||
name: 'machine-to-machine-jwt.ts',
|
name: 'machine-to-machine-jwt.js',
|
||||||
title: 'Machine-to-machine token',
|
title: 'Machine-to-machine token',
|
||||||
language: 'typescript',
|
language: 'typescript',
|
||||||
defaultValue: defaultClientCredentialsJwtCustomizerCode,
|
defaultValue: defaultClientCredentialsJwtCustomizerCode,
|
||||||
|
|
Loading…
Reference in a new issue