This commit is contained in:
longdayi 2025-05-26 19:56:40 +08:00
parent 32040f4457
commit 413e46ce14
1 changed files with 31 additions and 8 deletions

View File

@ -1,15 +1,38 @@
import { Configuration } from 'oidc-provider';
import { nanoid } from 'nanoid';
const config: Configuration = {
clients: [
{
client_id: 'example-client',
client_secret: 'example-secret',
grant_types: ['authorization_code'],
redirect_uris: ['http://localhost:3000/cb'],
clients: [
{
client_id: 'example-client',
client_secret: 'example-secret',
grant_types: ['authorization_code', 'refresh_token'],
redirect_uris: ['http://localhost:3000/callback'],
response_types: ['code'],
scope: 'openid email profile',
},
],
pkce: {
required: () => true, // 要求所有客户端使用PKCE
},
features: {
devInteractions: { enabled: false }, // 禁用开发交互界面
resourceIndicators: { enabled: true }, // 启用资源指示器
revocation: { enabled: true }, // 启用令牌撤销
userinfo: { enabled: true }, // 启用用户信息端点
},
cookies: {
keys: [nanoid()], // 用于签署和验证cookie
},
jwks: {
keys: [], // 在实际环境中应该生成并保存密钥
},
ttl: {
AccessToken: 3600, // 1小时
AuthorizationCode: 600, // 10分钟
IdToken: 3600, // 1小时
RefreshToken: 1209600, // 14天
},
],
// 其他配置项...
};
export default config;