You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.3.1: Refactor schema extension and permission validation:
- Replace legacy `EntitySchemaExtender` with `SPathUtil.extendEntitySchema`.
- Update `permissionValidation` to accept a `ValidationRequest` payload.
- Adjust all imports, interfaces, and test usage accordingly.
- Add `ValidationRequest` type documentation.
- Update Swagger‑Mate dependency to 1.3.2 and bump package version to 1.3.1.
* Verifies a JWT access token and returns the decoded payload or an error code.
49
+
*
50
+
* @param token - The JWT access token string to verify.
51
+
* @return A promise that resolves to the decoded token payload of type {@link JwtToken<T>} if verification succeeds, or a numeric error code if verification fails.
* @param {JwtToken<T>} data - The payload data for the token.
67
+
* @param {Record<string, any>} [extend] - Optional additional fields to merge into the token payload.
68
+
* @param {string|number} [expire] - Optional expiration time for the token, expressed in seconds or as an ISO 8601 duration string.
69
+
* @return {Promise<string>} A promise that resolves to the generated JWT token string.
70
+
*/
33
71
jwtGenerateAccessToken(
34
72
data: JwtToken<T>,
35
73
extend?: Record<string,any>,
36
74
expire?: string|number,
37
75
): Promise<string>;
38
76
77
+
/**
78
+
* Validates an API token for a specified user and request type.
79
+
*
80
+
* @param {string} username - The username associated with the token.
81
+
* @param {string} token - The API token to validate.
82
+
* @param {string} requestType - The type of request for which the token is being validated.
83
+
* @returns {Promise<{ valid: boolean; userId: string | null }>} A promise that resolves to an object containing a boolean indicating whether the token is valid and the user ID if validation succeeds; otherwise, `null` is returned for the user ID.
84
+
*/
39
85
apiTokenValidation(
40
86
username: string,
41
87
token: string,
42
88
requestType: string,
43
89
): Promise<{valid: boolean;userId: string|null}>;
44
90
45
-
permissionValidation(
46
-
token: JwtToken<T>,
47
-
requestType: string,
48
-
): Promise<boolean>;
49
-
91
+
/**
92
+
* Validates user permissions according to the supplied validation request.
93
+
*
94
+
* @param {ValidationRequest<T>} request - The request object containing the necessary
95
+
* data for permission evaluation, such as user identity, requested action,
96
+
* and contextual parameters.
97
+
*
98
+
* @return {Promise<boolean>} A promise that resolves to `true` if the permissions
99
+
* are valid for the specified request, otherwise resolves to `false`.
* Validates the bearer token present in the provided request.
105
+
* @param {XRequest} req - The HTTP request containing the Authorization header.
106
+
* @return {Promise<JwtToken<T> | number>} A promise that resolves to the decoded JWT payload if the token is valid, or a numeric status code (e.g., 401) if validation fails.
0 commit comments