@flipdish/authorization 0.2.12-rc.1765346440 → 0.2.14-rc.1766078374
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 +21 -16
- package/configuration.ts +1 -1
- package/dist/configuration.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,13 +70,15 @@ describe("Authorization Tests", () => {
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
test("List Feature Based Roles", async () => {
|
|
73
|
-
const featureBasedRolesResponse =
|
|
73
|
+
const featureBasedRolesResponse =
|
|
74
|
+
await configurationData.listFeatureBasedRoles();
|
|
74
75
|
expect(featureBasedRolesResponse.status).toBe(200);
|
|
75
76
|
expect(featureBasedRolesResponse.data.roles).toBeDefined();
|
|
76
77
|
expect(featureBasedRolesResponse.data.roles.length).toBeGreaterThan(0);
|
|
77
|
-
expect(featureBasedRolesResponse.data.roles).toContainEqual(
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
expect(featureBasedRolesResponse.data.roles).toContainEqual({
|
|
79
|
+
name: "OrgViewer",
|
|
80
|
+
permissions: ["ViewOrg"],
|
|
81
|
+
});
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
test("List named roles", async () => {
|
|
@@ -205,29 +207,32 @@ describe("Authorization Tests", () => {
|
|
|
205
207
|
});
|
|
206
208
|
|
|
207
209
|
it("should authenticate and check if a user is in a role with a valid FD-Authorization cookie", async () => {
|
|
208
|
-
const isInRoleResponse =
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
const isInRoleResponse =
|
|
211
|
+
await authorization.authenticateAndCheckIsInRole({
|
|
212
|
+
headers: {
|
|
213
|
+
Cookie: `FD-Authorization=${process.env.FD_AUTH_COOKIE_PROD};`,
|
|
214
|
+
},
|
|
215
|
+
roles: ["Admin"],
|
|
216
|
+
});
|
|
214
217
|
expect(isInRoleResponse.status).toBe(200);
|
|
215
218
|
expect(isInRoleResponse.data.authorized).toBe(false);
|
|
216
219
|
});
|
|
217
220
|
|
|
218
221
|
it("should authenticate and check if a user is in a role with a valid Bearer token", async () => {
|
|
219
|
-
const isInRoleResponse =
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
const isInRoleResponse =
|
|
223
|
+
await authorization.authenticateAndCheckIsInRole({
|
|
224
|
+
headers: {
|
|
225
|
+
Authorization: `Bearer ${process.env.FLIPDISH_BEARER_TOKEN_PROD}`,
|
|
226
|
+
},
|
|
227
|
+
roles: ["Admin"],
|
|
228
|
+
});
|
|
225
229
|
expect(isInRoleResponse.status).toBe(200);
|
|
226
230
|
expect(isInRoleResponse.data.authorized).toBe(false);
|
|
227
231
|
});
|
|
228
232
|
});
|
|
229
233
|
});
|
|
230
234
|
});
|
|
235
|
+
|
|
231
236
|
```
|
|
232
237
|
|
|
233
238
|
The generated Node module can be used in the following environments:
|
package/configuration.ts
CHANGED
|
@@ -100,7 +100,7 @@ export class Configuration {
|
|
|
100
100
|
|
|
101
101
|
const extraHeaders = param.useDefaultUserAgent ? {} : {
|
|
102
102
|
headers: {
|
|
103
|
-
"user-agent": "Flipdish authorization typescript SDK / 0.2.
|
|
103
|
+
"user-agent": "Flipdish authorization typescript SDK / 0.2.14-rc.1766078374"
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
|
package/dist/configuration.js
CHANGED
|
@@ -36,7 +36,7 @@ var Configuration = /** @class */ (function () {
|
|
|
36
36
|
this.serverIndex = param.serverIndex;
|
|
37
37
|
var extraHeaders = param.useDefaultUserAgent ? {} : {
|
|
38
38
|
headers: {
|
|
39
|
-
"user-agent": "Flipdish authorization typescript SDK / 0.2.
|
|
39
|
+
"user-agent": "Flipdish authorization typescript SDK / 0.2.14-rc.1766078374"
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
this.baseOptions = __assign(__assign({}, extraHeaders), param.baseOptions);
|
package/package.json
CHANGED