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', '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;