Skip to content

Commit

Permalink
fix(console): replace ts with js for JWT customizer (#5760)
Browse files Browse the repository at this point in the history
replace ts with js for JWT customizer
  • Loading branch information
simeng-li authored Apr 19, 2024
1 parent 9707d66 commit 15e543a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,17 @@ function MonacoCodeEditor({
}

if (activeModel.language === 'typescript') {
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
noSemanticValidation: false,
noSyntaxValidation: false,
});

// Set the typescript compiler options
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
allowNonTsExtensions: true,
strictNullChecks: true,
allowJs: true,
checkJs: true,
});
}
}, [activeModel, monaco, environmentVariablesDefinition]);
Expand Down
11 changes: 4 additions & 7 deletions packages/console/src/pages/CustomizeJwtDetails/utils/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* 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 {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.
*
* @returns The custom claims.
*/
const getCustomJwtClaims = async ({ token, context, environmentVariables }) => {
return {};
}`;
Expand All @@ -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.
* 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.EnvironmentVariables}} [payload.environmentVariables] - The environment variables.
*
* @returns The custom claims.
*/
const getCustomJwtClaims = async ({ token, environmentVariables }) => {
return {};
}`;

export const accessTokenJwtCustomizerModel: ModelSettings = {
name: 'user-jwt.ts',
name: 'user-jwt.js',
title: 'User access token',
language: 'typescript',
defaultValue: defaultAccessTokenJwtCustomizerCode,
Expand All @@ -93,7 +90,7 @@ export const accessTokenJwtCustomizerModel: ModelSettings = {
};

export const clientCredentialsModel: ModelSettings = {
name: 'machine-to-machine-jwt.ts',
name: 'machine-to-machine-jwt.js',
title: 'Machine-to-machine token',
language: 'typescript',
defaultValue: defaultClientCredentialsJwtCustomizerCode,
Expand Down

0 comments on commit 15e543a

Please sign in to comment.