feat(auth): 重构统一认证并支持平级服务无感登录
This commit is contained in:
1 parent
d79def5519
commit
ca312ea751
64 files changed
+3713
-449
No files matched your search
@@ -26,6 +26,7 @@ window.fetch = async (input: RequestInfo | URL, init?: RequestInit): Promise<Res
|
||||
url.includes('/api/user/login') ||
|
||||
url.includes('/api/user/casdoor/password-login') ||
|
||||
url.includes('/api/user/casdoor/login');
|
||||
const isOptionalSsoCatalogApi = /\/api\/sso\/apps(?:\?|$)/.test(url);
|
||||
if (res.status === 401 && isApi && !isRefreshApi) {
|
||||
const refreshed = await refreshAccessToken();
|
||||
if (refreshed) {
|
||||
@@ -35,7 +36,7 @@ window.fetch = async (input: RequestInfo | URL, init?: RequestInit): Promise<Res
|
||||
res = await runFetch(reqInit);
|
||||
}
|
||||
}
|
||||
if (res.status === 401 && isApi && !isLoginApi) {
|
||||
if (res.status === 401 && isApi && !isLoginApi && !isOptionalSsoCatalogApi) {
|
||||
window.dispatchEvent(new CustomEvent('hxops:unauthorized', { detail: { url, status: res.status } }));
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in new issue
Block a user