@yelon/bis 15.2.3 → 15.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/layout/yunzai-auth.service.mjs +28 -28
- package/fesm2015/layout.mjs +27 -29
- package/fesm2015/layout.mjs.map +1 -1
- package/fesm2020/layout.mjs +27 -27
- package/fesm2020/layout.mjs.map +1 -1
- package/package.json +11 -11
package/fesm2020/layout.mjs
CHANGED
|
@@ -1860,31 +1860,29 @@ class YunzaiAuthService {
|
|
|
1860
1860
|
}
|
|
1861
1861
|
askToken() {
|
|
1862
1862
|
log$1('yz.auth.service: ', 'askToken');
|
|
1863
|
-
if (this.tokenService.get()?.token) {
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1863
|
+
// if (this.tokenService.get()?.token) {
|
|
1864
|
+
// const notCovertToken = this.tokenService.get();
|
|
1865
|
+
// let convertedToken: ITokenModel;
|
|
1866
|
+
// if (notCovertToken && notCovertToken['access_token']) {
|
|
1867
|
+
// convertedToken = {
|
|
1868
|
+
// token: notCovertToken['access_token'],
|
|
1869
|
+
// expired: notCovertToken['expires_in'],
|
|
1870
|
+
// refreshToken: notCovertToken['refresh_token'],
|
|
1871
|
+
// scope: notCovertToken['scope'],
|
|
1872
|
+
// tokenType: notCovertToken['token_type']
|
|
1873
|
+
// };
|
|
1874
|
+
// return of(convertedToken);
|
|
1875
|
+
// } else {
|
|
1876
|
+
// return of(this.tokenService.get()!);
|
|
1877
|
+
// }
|
|
1878
|
+
// } else {
|
|
1879
|
+
if (this.config.loginForm) {
|
|
1880
|
+
return this.fetchTokenByUP();
|
|
1879
1881
|
}
|
|
1880
1882
|
else {
|
|
1881
|
-
|
|
1882
|
-
return this.fetchTokenByUP();
|
|
1883
|
-
}
|
|
1884
|
-
else {
|
|
1885
|
-
return this.fetchTokenByCas();
|
|
1886
|
-
}
|
|
1883
|
+
return this.fetchTokenByCas();
|
|
1887
1884
|
}
|
|
1885
|
+
// }
|
|
1888
1886
|
}
|
|
1889
1887
|
fetchTokenByUP() {
|
|
1890
1888
|
log$1('yz.auth.service: ', 'fetchTokenByUP');
|
|
@@ -1905,14 +1903,16 @@ class YunzaiAuthService {
|
|
|
1905
1903
|
return this.httpClient
|
|
1906
1904
|
.get(`/cas-proxy/app/validate_full?callback=${uri}&_allow_anonymous=true×tamp=${new Date().getTime()}`)
|
|
1907
1905
|
.pipe(map$1((response) => {
|
|
1906
|
+
// 查看缓存中的用户是否与token验证回的用户id相同,如果不同则缓存为过期缓存,进行清除
|
|
1907
|
+
if (response && response.userId) {
|
|
1908
|
+
const user = this.cacheService.get('_yz_user', { mode: 'none' });
|
|
1909
|
+
if (user && user.id && user.id !== response.userId) {
|
|
1910
|
+
this.cacheService.clear();
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1908
1913
|
switch (response.errcode) {
|
|
1909
1914
|
case 2000:
|
|
1910
1915
|
const { access_token, expires_in, refresh_token, scope, token_type } = response.data;
|
|
1911
|
-
// 如果token不一致,清除缓存
|
|
1912
|
-
const token = this.tokenService.get()?.token;
|
|
1913
|
-
if (token && access_token && token !== access_token) {
|
|
1914
|
-
this.cacheService.clear();
|
|
1915
|
-
}
|
|
1916
1916
|
return {
|
|
1917
1917
|
token: access_token,
|
|
1918
1918
|
expired: expires_in,
|