diff options
author | 2024-02-10 18:37:40 -0700 | |
---|---|---|
committer | 2024-02-13 06:59:44 +0530 | |
commit | e1c47572a6235fd8fd20af888ac3a11c7ae1369d (patch) | |
tree | 2dccff36a441916d7014037cef3f7ce84a790cad /config/auth.ts | |
parent | refactor: project maintenance (diff) | |
download | ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.gz ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.zst ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.zip |
updates
Diffstat (limited to 'config/auth.ts')
-rw-r--r-- | config/auth.ts | 18 |
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 | ||
8 | import { AuthConfig } from '@ioc:Adonis/Addons/Auth' | 8 | import { AuthConfig } from '@ioc:Adonis/Addons/Auth'; |
9 | import env from '#start/env' | 9 | import env from '#start/env'; |
10 | import { appKey, jwtUsePEM } from './app.js' | 10 | import { 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 | ||
259 | export default authConfig | 263 | export default authConfig; |