@zjazj/server 0.0.6 → 0.0.7
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.
|
@@ -98,13 +98,19 @@ function createVerifier(options) {
|
|
|
98
98
|
});
|
|
99
99
|
payload = result.payload;
|
|
100
100
|
} catch (error) {
|
|
101
|
-
if (error instanceof joseErrors.JWTExpired)
|
|
101
|
+
if (error instanceof joseErrors.JWTExpired) {
|
|
102
|
+
throw new UnauthorizedError("token expired", { code: "token_expired" });
|
|
103
|
+
}
|
|
102
104
|
throw new UnauthorizedError("invalid token", { cause: error });
|
|
103
105
|
}
|
|
104
106
|
if (!options.audience && !hasOrganizationAudience(payload.aud)) {
|
|
105
107
|
throw new UnauthorizedError("token audience is not an organization");
|
|
106
108
|
}
|
|
107
|
-
|
|
109
|
+
const user = userFromClaims(payload);
|
|
110
|
+
if (user.support && user.support.until <= Date.now() / 1e3) {
|
|
111
|
+
throw new UnauthorizedError("support session ended", { code: "support_ended" });
|
|
112
|
+
}
|
|
113
|
+
return user;
|
|
108
114
|
}
|
|
109
115
|
};
|
|
110
116
|
}
|
package/dist/index.js
CHANGED
package/dist/testing.js
CHANGED
package/package.json
CHANGED