najm-auth 1.1.43 → 1.1.44
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/dist/index.d.ts +7 -0
- package/dist/index.js +17 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1199,6 +1199,13 @@ declare class AuthResolver {
|
|
|
1199
1199
|
private container;
|
|
1200
1200
|
private app;
|
|
1201
1201
|
private log;
|
|
1202
|
+
/**
|
|
1203
|
+
* Missing/stale/invalid credentials (4xx) are an expected client state on
|
|
1204
|
+
* these resolve paths — e.g. a refresh cookie that outlived its DB row
|
|
1205
|
+
* after a reseed or rotation. Log those at debug; reserve warn for
|
|
1206
|
+
* unexpected (5xx/non-HTTP) failures.
|
|
1207
|
+
*/
|
|
1208
|
+
private logResolveMiss;
|
|
1202
1209
|
resolve(token: string): Promise<{
|
|
1203
1210
|
user: any;
|
|
1204
1211
|
role?: string;
|
package/dist/index.js
CHANGED
|
@@ -2739,6 +2739,20 @@ var AuthResolver = class AuthResolver2 {
|
|
|
2739
2739
|
container;
|
|
2740
2740
|
app;
|
|
2741
2741
|
log;
|
|
2742
|
+
/**
|
|
2743
|
+
* Missing/stale/invalid credentials (4xx) are an expected client state on
|
|
2744
|
+
* these resolve paths — e.g. a refresh cookie that outlived its DB row
|
|
2745
|
+
* after a reseed or rotation. Log those at debug; reserve warn for
|
|
2746
|
+
* unexpected (5xx/non-HTTP) failures.
|
|
2747
|
+
*/
|
|
2748
|
+
logResolveMiss(message, error) {
|
|
2749
|
+
const status = error?.status;
|
|
2750
|
+
if (typeof status === "number" && status < 500) {
|
|
2751
|
+
this.log.debug(message, error);
|
|
2752
|
+
} else {
|
|
2753
|
+
this.log.warn(message, error);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2742
2756
|
async resolve(token) {
|
|
2743
2757
|
if (!token)
|
|
2744
2758
|
return false;
|
|
@@ -2754,7 +2768,7 @@ var AuthResolver = class AuthResolver2 {
|
|
|
2754
2768
|
permissions: user.permissions
|
|
2755
2769
|
};
|
|
2756
2770
|
} catch (error) {
|
|
2757
|
-
this.
|
|
2771
|
+
this.logResolveMiss("Token verification failed", error);
|
|
2758
2772
|
return false;
|
|
2759
2773
|
}
|
|
2760
2774
|
}
|
|
@@ -2770,7 +2784,7 @@ var AuthResolver = class AuthResolver2 {
|
|
|
2770
2784
|
permissions: session.permissions
|
|
2771
2785
|
};
|
|
2772
2786
|
} catch (error) {
|
|
2773
|
-
this.
|
|
2787
|
+
this.logResolveMiss("Session cookie verification failed", error);
|
|
2774
2788
|
return false;
|
|
2775
2789
|
}
|
|
2776
2790
|
}
|
|
@@ -2794,7 +2808,7 @@ var AuthResolver = class AuthResolver2 {
|
|
|
2794
2808
|
permissions: user.permissions
|
|
2795
2809
|
};
|
|
2796
2810
|
} catch (error) {
|
|
2797
|
-
this.
|
|
2811
|
+
this.logResolveMiss("Cookie verification failed", error);
|
|
2798
2812
|
return false;
|
|
2799
2813
|
}
|
|
2800
2814
|
}
|