@tidecloak/verify 0.11.5 → 0.12.15
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 +3 -3
- package/dist/cjs/TideJWT.js +1 -1
- package/dist/esm/TideJWT.js +1 -1
- package/dist/types/TideJWT.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,9 +30,9 @@ import { verifyTideCloakToken } from '@tidecloak/verify';
|
|
|
30
30
|
|
|
31
31
|
| Parameter | Type | Description |
|
|
32
32
|
| -------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
33
|
-
| `config` | `object` | Your TideCloak adapter JSON (the
|
|
33
|
+
| `config` | `object` | Your TideCloak adapter JSON (the Tidecloak client configuration you download from your realm settings). |
|
|
34
34
|
| `token` | `string` | The raw JWT (access token) to verify. |
|
|
35
|
-
| `allowedRoles` | `string[]` (optional) | Array of
|
|
35
|
+
| `allowedRoles` | `string[]` (optional) | Array of Tidecloak realm or client roles. If provided, the user must have at least one of these roles in their token. |
|
|
36
36
|
|
|
37
37
|
**Returns:**
|
|
38
38
|
`Promise<object | null>`
|
|
@@ -46,7 +46,7 @@ Internally, `verifyTideCloakToken` uses the [jose](https://github.com/panva/jose
|
|
|
46
46
|
|
|
47
47
|
1. Ensure a token is present.
|
|
48
48
|
2. Construct the correct issuer URL from `config['auth-server-url']` and `config.realm`.
|
|
49
|
-
3. Choose between a local JWK Set (`config.jwk.keys`) or fetch the JWK Set remotely from
|
|
49
|
+
3. Choose between a local JWK Set (`config.jwk.keys`) or fetch the JWK Set remotely from Tidecloak.
|
|
50
50
|
4. Verify the token's signature, issuer, and `azp` (authorized party) against `config.resource`.
|
|
51
51
|
5. Extract realm (`payload.realm_access.roles`) and client (`payload.resource_access[resource].roles`) roles.
|
|
52
52
|
6. Check for at least one matching role if `allowedRoles` is specified.
|
package/dist/cjs/TideJWT.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jwtVerify, createLocalJWKSet, createRemoteJWKSet } from "jose";
|
|
|
4
4
|
*
|
|
5
5
|
* @param {object} config - Imported TideCloak configuration (parsed JSON).
|
|
6
6
|
* @param {string} token - access token to verify.
|
|
7
|
-
* @param {string[]} [allowedRoles] - Array of
|
|
7
|
+
* @param {string[]} [allowedRoles] - Array of Tidecloak realm or client roles; user must have at least one.
|
|
8
8
|
* @returns {Promise<object|null>} - The token payload if valid and role-check passes, otherwise null.
|
|
9
9
|
*/
|
|
10
10
|
export async function verifyTideCloakToken(config, token, allowedRoles = []) {
|
package/dist/esm/TideJWT.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jwtVerify, createLocalJWKSet, createRemoteJWKSet } from "jose";
|
|
|
4
4
|
*
|
|
5
5
|
* @param {object} config - Imported TideCloak configuration (parsed JSON).
|
|
6
6
|
* @param {string} token - access token to verify.
|
|
7
|
-
* @param {string[]} [allowedRoles] - Array of
|
|
7
|
+
* @param {string[]} [allowedRoles] - Array of Tidecloak realm or client roles; user must have at least one.
|
|
8
8
|
* @returns {Promise<object|null>} - The token payload if valid and role-check passes, otherwise null.
|
|
9
9
|
*/
|
|
10
10
|
export async function verifyTideCloakToken(config, token, allowedRoles = []) {
|
package/dist/types/TideJWT.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {object} config - Imported TideCloak configuration (parsed JSON).
|
|
5
5
|
* @param {string} token - access token to verify.
|
|
6
|
-
* @param {string[]} [allowedRoles] - Array of
|
|
6
|
+
* @param {string[]} [allowedRoles] - Array of Tidecloak realm or client roles; user must have at least one.
|
|
7
7
|
* @returns {Promise<object|null>} - The token payload if valid and role-check passes, otherwise null.
|
|
8
8
|
*/
|
|
9
9
|
export function verifyTideCloakToken(config: object, token: string, allowedRoles?: string[]): Promise<object | null>;
|