39 lines
924 B
TypeScript
39 lines
924 B
TypeScript
export interface AuthConfig {
|
|
apiResource: string;
|
|
appId: string;
|
|
enableDevAuthPanel: boolean;
|
|
logtoEndpoint: string;
|
|
scopes: string[];
|
|
}
|
|
|
|
const defaultAuthConfig: AuthConfig = {
|
|
apiResource: "https://talent-search.intelligrow.cn",
|
|
appId: "i4jkllbvih0554r4n0fd3",
|
|
enableDevAuthPanel: false,
|
|
logtoEndpoint: "https://login-api.intelligrow.cn",
|
|
scopes: ["openid", "profile", "offline_access", "talent-search:read"]
|
|
};
|
|
|
|
export function readAuthConfig(
|
|
overrides: Partial<AuthConfig> = {}
|
|
): AuthConfig {
|
|
const nextConfig = {
|
|
...defaultAuthConfig,
|
|
...overrides
|
|
};
|
|
|
|
if (!nextConfig.logtoEndpoint.trim()) {
|
|
throw new Error("auth config logtoEndpoint is required");
|
|
}
|
|
|
|
if (!nextConfig.appId.trim()) {
|
|
throw new Error("auth config appId is required");
|
|
}
|
|
|
|
if (!nextConfig.apiResource.trim()) {
|
|
throw new Error("auth config apiResource is required");
|
|
}
|
|
|
|
return nextConfig;
|
|
}
|