@yelon/bis 15.2.4 → 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 +25 -6
- package/fesm2015/layout.mjs +24 -6
- package/fesm2015/layout.mjs.map +1 -1
- package/fesm2020/layout.mjs +24 -5
- package/fesm2020/layout.mjs.map +1 -1
- package/package.json +11 -11
package/fesm2020/layout.mjs
CHANGED
|
@@ -1860,12 +1860,29 @@ class YunzaiAuthService {
|
|
|
1860
1860
|
}
|
|
1861
1861
|
askToken() {
|
|
1862
1862
|
log$1('yz.auth.service: ', 'askToken');
|
|
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 {
|
|
1863
1879
|
if (this.config.loginForm) {
|
|
1864
1880
|
return this.fetchTokenByUP();
|
|
1865
1881
|
}
|
|
1866
1882
|
else {
|
|
1867
1883
|
return this.fetchTokenByCas();
|
|
1868
1884
|
}
|
|
1885
|
+
// }
|
|
1869
1886
|
}
|
|
1870
1887
|
fetchTokenByUP() {
|
|
1871
1888
|
log$1('yz.auth.service: ', 'fetchTokenByUP');
|
|
@@ -1886,14 +1903,16 @@ class YunzaiAuthService {
|
|
|
1886
1903
|
return this.httpClient
|
|
1887
1904
|
.get(`/cas-proxy/app/validate_full?callback=${uri}&_allow_anonymous=true×tamp=${new Date().getTime()}`)
|
|
1888
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
|
+
}
|
|
1889
1913
|
switch (response.errcode) {
|
|
1890
1914
|
case 2000:
|
|
1891
1915
|
const { access_token, expires_in, refresh_token, scope, token_type } = response.data;
|
|
1892
|
-
// 如果token不一致,清除缓存
|
|
1893
|
-
const token = this.tokenService.get()?.token;
|
|
1894
|
-
if (token && access_token && token !== access_token) {
|
|
1895
|
-
this.cacheService.clear();
|
|
1896
|
-
}
|
|
1897
1916
|
return {
|
|
1898
1917
|
token: access_token,
|
|
1899
1918
|
expired: expires_in,
|