@rdlabo/ionic-angular-kit 21.4.11 → 21.5.1
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/README.md +32 -33
- package/fesm2022/rdlabo-ionic-angular-kit-offline.mjs +107 -1
- package/fesm2022/rdlabo-ionic-angular-kit-offline.mjs.map +1 -1
- package/fesm2022/rdlabo-ionic-angular-kit.mjs +15 -2
- package/fesm2022/rdlabo-ionic-angular-kit.mjs.map +1 -1
- package/package.json +1 -1
- package/types/rdlabo-ionic-angular-kit-offline.d.ts +78 -3
- package/types/rdlabo-ionic-angular-kit.d.ts +22 -0
|
@@ -1840,6 +1840,17 @@ const KIT_HTTP_CONFIG = new InjectionToken('@rdlabo/ionic-angular-kit:http');
|
|
|
1840
1840
|
* ```
|
|
1841
1841
|
*/
|
|
1842
1842
|
const provideKitHttp = (configFactory) => makeEnvironmentProviders([{ provide: KIT_HTTP_CONFIG, useFactory: configFactory }]);
|
|
1843
|
+
/**
|
|
1844
|
+
* True when shared remote access should be revoked for an auth-related failure.
|
|
1845
|
+
*
|
|
1846
|
+
* @remarks
|
|
1847
|
+
* Only meaningful when {@link KitHttpConfig.enforceAuthAccessMode} is enabled and
|
|
1848
|
+
* {@link isExplicitAuthDenial} already matched. When {@link KitHttpConfig.isAuthAccessDenial} is
|
|
1849
|
+
* omitted, every explicit denial revokes access (legacy default).
|
|
1850
|
+
*
|
|
1851
|
+
* @internal
|
|
1852
|
+
*/
|
|
1853
|
+
const shouldRevokeAuthAccess = (config, req, error) => config.isAuthAccessDenial?.(req, error) ?? isExplicitAuthDenial(error);
|
|
1843
1854
|
/**
|
|
1844
1855
|
* Classify a final (post-retry) error and invoke the matching {@link KitHttpConfig} hook.
|
|
1845
1856
|
*
|
|
@@ -1932,8 +1943,9 @@ const kitAuthInterceptor = (request, next) => {
|
|
|
1932
1943
|
}
|
|
1933
1944
|
return from(Promise.resolve(config.getAuthHeaders(request))).pipe(catchError((headerError) => {
|
|
1934
1945
|
// getAuthHeaders failed → the request is never sent; classify it instead of failing silently.
|
|
1935
|
-
if (config.enforceAuthAccessMode && isExplicitAuthDenial(headerError))
|
|
1946
|
+
if (config.enforceAuthAccessMode && isExplicitAuthDenial(headerError) && shouldRevokeAuthAccess(config, request, headerError)) {
|
|
1936
1947
|
access.clear();
|
|
1948
|
+
}
|
|
1937
1949
|
config.onAuthError?.(request, headerError);
|
|
1938
1950
|
return throwError(() => headerError);
|
|
1939
1951
|
}), mergeMap((authHeaders) => {
|
|
@@ -1972,7 +1984,8 @@ const kitAuthInterceptor = (request, next) => {
|
|
|
1972
1984
|
}
|
|
1973
1985
|
}), catchError((error) => {
|
|
1974
1986
|
if (config.enforceAuthAccessMode && isExplicitAuthDenial(error)) {
|
|
1975
|
-
|
|
1987
|
+
if (shouldRevokeAuthAccess(config, req, error))
|
|
1988
|
+
access.clear();
|
|
1976
1989
|
dispatchError(config, req, error);
|
|
1977
1990
|
return throwError(() => error);
|
|
1978
1991
|
}
|