From 0240e5cac2ef7b0c6bd7d72e26310907f250eaa4 Mon Sep 17 00:00:00 2001 From: simeng-li Date: Wed, 6 Jul 2022 20:33:25 +0800 Subject: [PATCH] chore(core): add default ttl settings (#1429) add default ttl settings to avoid oidc warning --- packages/core/src/oidc/init.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/core/src/oidc/init.ts b/packages/core/src/oidc/init.ts index f174cf656..396886764 100644 --- a/packages/core/src/oidc/init.ts +++ b/packages/core/src/oidc/init.ts @@ -132,6 +132,16 @@ export default async function initOidc(app: Koa): Promise { return refreshTokenTtl ?? defaultRefreshTokenTtl; }, + AccessToken: (ctx, token) => { + if (token.resourceServer) { + return token.resourceServer.accessTokenTTL ?? 60 * 60; // 1 hour in seconds + } + + return 60 * 60; // 1 hour in seconds + }, + Interaction: 3600 /* 1 hour in seconds */, + Session: 1_209_600 /* 14 days in seconds */, + Grant: 1_209_600 /* 14 days in seconds */, }, extraTokenClaims: async (_ctx, token) => { // AccessToken type is not exported by default, need to asset token is AccessToken