@carecard/jwt-read 3.1.28 → 3.1.29
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/.agents/skills/pkg-jwt-read-jwt-middleware-library/SKILL.md +5 -0
- package/index.d.ts +3 -0
- package/index.js +2 -0
- package/lib/jwtLib.js +2 -0
- package/package.json +1 -1
- package/readme.md +3 -0
|
@@ -106,6 +106,11 @@ depend on those folders being present.
|
|
|
106
106
|
- Request attachment behavior for authenticated JWT objects and visitor tokens.
|
|
107
107
|
- Request attachment behavior for compact scoped authorization-context JWTs
|
|
108
108
|
from `X-Authorization-Context` as `req.userAuthorization`.
|
|
109
|
+
- Shared header defaults for scoped authorization context:
|
|
110
|
+
`DEFAULT_USER_AUTHORIZATION_HEADER_NAME` and
|
|
111
|
+
`DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH`. Token issuers and consuming
|
|
112
|
+
services should import these constants instead of duplicating the header name
|
|
113
|
+
or 2048-character limit.
|
|
109
114
|
- Server-auth request attachment behavior that normalizes introspected claims
|
|
110
115
|
into `req.jwt.payload` with `authMode: "server-auth"` and
|
|
111
116
|
`auth_mode: "server-auth"`.
|
package/index.d.ts
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { NextFunction, Request, Response } from 'express';
|
|
6
6
|
|
|
7
|
+
export const DEFAULT_USER_AUTHORIZATION_HEADER_NAME: 'X-Authorization-Context';
|
|
8
|
+
export const DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH: 2048;
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* Represents the standard JWT header structure.
|
|
9
12
|
*/
|
package/index.js
CHANGED
|
@@ -2,6 +2,8 @@ const jwtLib = require('./lib/jwtLib');
|
|
|
2
2
|
const jwtRoles = require('./lib/jwtRoles');
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
|
+
DEFAULT_USER_AUTHORIZATION_HEADER_NAME: jwtLib.DEFAULT_USER_AUTHORIZATION_HEADER_NAME,
|
|
6
|
+
DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH: jwtLib.DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH,
|
|
5
7
|
jwtVerify: jwtLib.verifyJwt,
|
|
6
8
|
jwtVerifyWebToken: jwtLib.verifyWebToken,
|
|
7
9
|
jwtVerifyNoThrow: jwtLib.verifyJwtNoThrow,
|
package/lib/jwtLib.js
CHANGED
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -141,6 +141,9 @@ database context and role checks.
|
|
|
141
141
|
Use `jwtVerifyUserAuthorization` when a route needs to verify only the compact
|
|
142
142
|
authorization-context token carried in `X-Authorization-Context`. The token is
|
|
143
143
|
read as a raw JWT header value, not as `Bearer <token>`.
|
|
144
|
+
The exported `DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH` is `2048`; token
|
|
145
|
+
issuers and consumers should use that shared constant instead of duplicating a
|
|
146
|
+
local limit.
|
|
144
147
|
|
|
145
148
|
```javascript
|
|
146
149
|
const { jwtVerifyUserAuthorization } = require('@carecard/jwt-read');
|