添加OAuth2认证相关配置文件和服务实现,包括环境变量配置、PKCE流程支持、token管理等功能。主要变更: - 新增OAuth2配置文件 - 实现OAuth2服务层 - 更新请求拦截器支持token自动刷新 - 修改认证API和store以支持OAuth2流程
26 lines
910 B
TypeScript
26 lines
910 B
TypeScript
import type { UserManager, UserManagerSettings } from 'oidc-client-ts';
|
|
|
|
/**
|
|
* OIDC 配置
|
|
* OIDC Configuration
|
|
*/
|
|
export const oidcConfig: UserManagerSettings = {
|
|
authority: import.meta.env.VITE_AUTH_SERVER_URL || 'http://localhost:5132',
|
|
client_id: 'fengling-console',
|
|
redirect_uri: window.location.origin + '/auth/callback',
|
|
post_logout_redirect_uri: window.location.origin + '/auth/logout-callback',
|
|
response_type: 'code',
|
|
scope: 'openid profile email api offline_access',
|
|
automaticSilentRenew: true,
|
|
includeIdTokenInSilentRenew: false,
|
|
loadUserInfo: true,
|
|
filterProtocolClaims: true,
|
|
accessTokenExpiringNotificationTimeInSeconds: 60,
|
|
silentRequestTimeoutInSeconds: 10000,
|
|
silent_redirect_uri: window.location.origin + '/silent-renew.html',
|
|
checkSessionIntervalInSeconds: 60000,
|
|
query_status_response_type: 'fragment',
|
|
};
|
|
|
|
export type { UserManagerSettings, UserManager };
|