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