@degenerate/generic 0.1.4 → 0.1.5
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.
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
* This file contains the helper functions for the incoming request objects.
|
|
3
3
|
* It is used to set and get the user object from the request object.
|
|
4
4
|
*/
|
|
5
|
+
import { AuthorizationAudience } from '../../models/authorization/authorization-models';
|
|
6
|
+
/**
|
|
7
|
+
* This function sets the Authorization Audience on the request object.
|
|
8
|
+
*
|
|
9
|
+
* @param req the incoming request object
|
|
10
|
+
* @param userObject the user object to set
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare const setAuthorizationAudience: (req: any, authorizationAudience: AuthorizationAudience) => void;
|
|
14
|
+
/**
|
|
15
|
+
* This function gets the Authorization Audience from the request object.
|
|
16
|
+
* @param req the incoming request object
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
declare const getAuthorizationAudience: (req: any) => AuthorizationAudience;
|
|
5
20
|
/**
|
|
6
21
|
* This function sets the IUserWithClaims object into the req.user object.
|
|
7
22
|
* @param req the incoming request object
|
|
@@ -15,5 +30,5 @@ declare const setUserRequest: (req: any, userObject: any) => void;
|
|
|
15
30
|
* @returns
|
|
16
31
|
*/
|
|
17
32
|
declare const getUserRequest: (req: any) => any;
|
|
18
|
-
export { setUserRequest, getUserRequest };
|
|
33
|
+
export { setAuthorizationAudience, getAuthorizationAudience, setUserRequest, getUserRequest, };
|
|
19
34
|
//# sourceMappingURL=request-object-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-object-helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/request-object-helpers.ts"],"names":[],"mappings":"AACA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"request-object-helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers/request/request-object-helpers.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AASxF;;;;;;GAMG;AACH,QAAA,MAAM,wBAAwB,QAAS,GAAG,yBAAyB,qBAAqB,KAAG,IAE1F,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,wBAAwB,QAAS,GAAG,KAAG,qBAE5C,CAAA;AAID;;;;;GAKG;AACH,QAAA,MAAM,cAAc,QAAS,GAAG,cAAc,GAAG,KAAG,IAEnD,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,cAAc,QAAS,GAAG,KAAG,GAElC,CAAC;AAGF,OAAO,EACH,wBAAwB,EACxB,wBAAwB,EACxB,cAAc,EACd,cAAc,GACjB,CAAC"}
|
|
@@ -5,8 +5,31 @@
|
|
|
5
5
|
* It is used to set and get the user object from the request object.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.getUserRequest = exports.setUserRequest = void 0;
|
|
8
|
+
exports.getUserRequest = exports.setUserRequest = exports.getAuthorizationAudience = exports.setAuthorizationAudience = void 0;
|
|
9
9
|
const USER_REQUEST_KEY = 'user';
|
|
10
|
+
const AUTHORIZATION_AUDIENCE_KEY = 'authorizationAudience';
|
|
11
|
+
//#region Authorization
|
|
12
|
+
/**
|
|
13
|
+
* This function sets the Authorization Audience on the request object.
|
|
14
|
+
*
|
|
15
|
+
* @param req the incoming request object
|
|
16
|
+
* @param userObject the user object to set
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
const setAuthorizationAudience = (req, authorizationAudience) => {
|
|
20
|
+
req[AUTHORIZATION_AUDIENCE_KEY] = authorizationAudience;
|
|
21
|
+
};
|
|
22
|
+
exports.setAuthorizationAudience = setAuthorizationAudience;
|
|
23
|
+
/**
|
|
24
|
+
* This function gets the Authorization Audience from the request object.
|
|
25
|
+
* @param req the incoming request object
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
const getAuthorizationAudience = (req) => {
|
|
29
|
+
return req[AUTHORIZATION_AUDIENCE_KEY];
|
|
30
|
+
};
|
|
31
|
+
exports.getAuthorizationAudience = getAuthorizationAudience;
|
|
32
|
+
//#endregion Authorization
|
|
10
33
|
/**
|
|
11
34
|
* This function sets the IUserWithClaims object into the req.user object.
|
|
12
35
|
* @param req the incoming request object
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@degenerate/generic",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "This contains the generic information needed for the ShareData Adaptive Framework Ecosystem (SAFE) network",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"firebase-functions": "^6.1.0",
|
|
54
54
|
"jsonwebtoken": "^9.0.2"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "767914ec1e949e62232a4c3a95c705e75d9c9275"
|
|
57
57
|
}
|