mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 22:28:15 +00:00
Fix CLI refresh token functionality + reduce token lifetime to 1d & 14d
for refresh
This commit is contained in:
@@ -101,9 +101,9 @@ const envSchema = z
|
||||
LOOPS_API_KEY: zpStr(z.string().optional()),
|
||||
// jwt options
|
||||
AUTH_SECRET: zpStr(z.string()).default(process.env.JWT_AUTH_SECRET), // for those still using old JWT_AUTH_SECRET
|
||||
JWT_AUTH_LIFETIME: zpStr(z.string().default("10d")),
|
||||
JWT_AUTH_LIFETIME: zpStr(z.string().default("1d")),
|
||||
JWT_SIGNUP_LIFETIME: zpStr(z.string().default("15m")),
|
||||
JWT_REFRESH_LIFETIME: zpStr(z.string().default("90d")),
|
||||
JWT_REFRESH_LIFETIME: zpStr(z.string().default("14d")),
|
||||
JWT_INVITE_LIFETIME: zpStr(z.string().default("1d")),
|
||||
JWT_MFA_LIFETIME: zpStr(z.string().default("5m")),
|
||||
JWT_PROVIDER_AUTH_LIFETIME: zpStr(z.string().default("15m")),
|
||||
|
||||
@@ -107,7 +107,7 @@ export const injectIdentity = fp(async (server: FastifyZodProvider) => {
|
||||
server.addHook("onRequest", async (req) => {
|
||||
const appCfg = getConfig();
|
||||
|
||||
if (req.url.includes(".well-known/est") || req.url.includes("/api/v3/auth/")) {
|
||||
if (req.url.includes(".well-known/est") || req.url.includes("/api/v3/auth/") || req.url === "/api/v1/auth/token") {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@ export const registerLoginRouter = async (server: FastifyZodProvider) => {
|
||||
200: z.object({
|
||||
token: z.string(),
|
||||
isMfaEnabled: z.boolean(),
|
||||
mfaMethod: z.string().optional()
|
||||
mfaMethod: z.string().optional(),
|
||||
refreshToken: z.string().optional()
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -101,7 +102,7 @@ export const registerLoginRouter = async (server: FastifyZodProvider) => {
|
||||
maxAge: 0
|
||||
});
|
||||
|
||||
return { token: tokens.access, isMfaEnabled: false };
|
||||
return { token: tokens.access, isMfaEnabled: false, refreshToken: tokens.refresh };
|
||||
}
|
||||
});
|
||||
|
||||
@@ -129,7 +130,8 @@ export const registerLoginRouter = async (server: FastifyZodProvider) => {
|
||||
encryptedPrivateKey: z.string(),
|
||||
iv: z.string(),
|
||||
tag: z.string(),
|
||||
token: z.string()
|
||||
token: z.string(),
|
||||
refreshToken: z.string().optional()
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -172,7 +174,8 @@ export const registerLoginRouter = async (server: FastifyZodProvider) => {
|
||||
tag: data.user.tag,
|
||||
protectedKey: data.user.protectedKey || null,
|
||||
protectedKeyIV: data.user.protectedKeyIV || null,
|
||||
protectedKeyTag: data.user.protectedKeyTag || null
|
||||
protectedKeyTag: data.user.protectedKeyTag || null,
|
||||
refreshToken: data.token.refresh
|
||||
} as const;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user