aboutsummaryrefslogtreecommitdiffstats
path: root/config/auth.ts
diff options
context:
space:
mode:
Diffstat (limited to 'config/auth.ts')
-rw-r--r--config/auth.ts18
1 files changed, 11 insertions, 7 deletions
diff --git a/config/auth.ts b/config/auth.ts
index f43bbdb..a3fcc45 100644
--- a/config/auth.ts
+++ b/config/auth.ts
@@ -5,9 +5,9 @@
5 * file. 5 * file.
6 */ 6 */
7 7
8import { AuthConfig } from '@ioc:Adonis/Addons/Auth' 8import { AuthConfig } from '@ioc:Adonis/Addons/Auth';
9import env from '#start/env' 9import env from '#start/env';
10import { appKey, jwtUsePEM } from './app.js' 10import { appKey, jwtUsePEM } from './app.js';
11 11
12/* 12/*
13|-------------------------------------------------------------------------- 13|--------------------------------------------------------------------------
@@ -233,8 +233,12 @@ const authConfig: AuthConfig = {
233 driver: 'jwt', 233 driver: 'jwt',
234 secret: jwtUsePEM ? undefined : appKey, 234 secret: jwtUsePEM ? undefined : appKey,
235 algorithmJwt: jwtUsePEM ? undefined : 'HS256', 235 algorithmJwt: jwtUsePEM ? undefined : 'HS256',
236 publicKey: jwtUsePEM ? env.get('JWT_PUBLIC_KEY', '').replaceAll('\\n', '\n') : undefined, 236 publicKey: jwtUsePEM
237 privateKey: jwtUsePEM ? env.get('JWT_PRIVATE_KEY', '').replaceAll('\\n', '\n') : undefined, 237 ? env.get('JWT_PUBLIC_KEY', '').replaceAll('\\n', '\n')
238 : undefined,
239 privateKey: jwtUsePEM
240 ? env.get('JWT_PRIVATE_KEY', '').replaceAll('\\n', '\n')
241 : undefined,
238 persistJwt: true, 242 persistJwt: true,
239 // TODO: We should improve the following implementation as this is a security concern. 243 // TODO: We should improve the following implementation as this is a security concern.
240 // The following ts-expect-error is to set exp to undefined (JWT with no expiration) 244 // The following ts-expect-error is to set exp to undefined (JWT with no expiration)
@@ -254,6 +258,6 @@ const authConfig: AuthConfig = {
254 }, 258 },
255 }, 259 },
256 }, 260 },
257} 261};
258 262
259export default authConfig 263export default authConfig;