@camunda/e2e-test-suite 0.0.1697 → 0.0.1698
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.
|
@@ -15,6 +15,7 @@ const assertions_1 = require("../../../../utils/api/assertions");
|
|
|
15
15
|
const beans_1 = require("../../../../utils/api/beans");
|
|
16
16
|
const eventually_1 = require("../../../../utils/api/eventually");
|
|
17
17
|
const bpmn_1 = require("../../../../utils/api/bpmn");
|
|
18
|
+
const capabilities_1 = require("../../../../utils/api/capabilities");
|
|
18
19
|
api_1.test.describe('Role membership for clients and mapping rules', () => {
|
|
19
20
|
(0, api_1.test)('assigns and removes a client', async ({ api, resources }) => {
|
|
20
21
|
const role = (0, beans_1.newRole)();
|
|
@@ -43,6 +44,9 @@ api_1.test.describe('Role membership for clients and mapping rules', () => {
|
|
|
43
44
|
await (0, assertions_1.assertStatusIn)(remove, [204], 'removal is acknowledged');
|
|
44
45
|
});
|
|
45
46
|
(0, api_1.test)('assigns and removes a mapping rule', async ({ api, resources }) => {
|
|
47
|
+
api_1.test.skip(capabilities_1.mappingRuleAssignmentUnavailable !== false, capabilities_1.mappingRuleAssignmentUnavailable === false
|
|
48
|
+
? ''
|
|
49
|
+
: capabilities_1.mappingRuleAssignmentUnavailable);
|
|
46
50
|
const role = (0, beans_1.newRole)();
|
|
47
51
|
await (0, assertions_1.assertCreated)(await api.post('/roles', { body: role, tenant: 'none' }));
|
|
48
52
|
resources.track('role', role.roleId);
|
|
@@ -106,6 +110,9 @@ api_1.test.describe('Group membership for clients and mapping rules', () => {
|
|
|
106
110
|
await (0, assertions_1.assertStatusIn)(remove, [204], 'removal is acknowledged');
|
|
107
111
|
});
|
|
108
112
|
(0, api_1.test)('assigns and removes a mapping rule', async ({ api, resources }) => {
|
|
113
|
+
api_1.test.skip(capabilities_1.mappingRuleAssignmentUnavailable !== false, capabilities_1.mappingRuleAssignmentUnavailable === false
|
|
114
|
+
? ''
|
|
115
|
+
: capabilities_1.mappingRuleAssignmentUnavailable);
|
|
109
116
|
const group = (0, beans_1.newGroup)();
|
|
110
117
|
await (0, assertions_1.assertCreated)(await api.post('/groups', { body: group, tenant: 'none' }));
|
|
111
118
|
resources.track('group', group.groupId);
|
|
@@ -134,6 +141,30 @@ api_1.test.describe('Group membership for clients and mapping rules', () => {
|
|
|
134
141
|
await (0, assertions_1.assertStatusIn)(remove, [204], 'removal is acknowledged');
|
|
135
142
|
});
|
|
136
143
|
});
|
|
144
|
+
api_1.test.describe('Mapping-rule assignment without an identity provider', () => {
|
|
145
|
+
(0, api_1.test)('is refused for roles and groups', async ({ api, resources }) => {
|
|
146
|
+
api_1.test.skip(capabilities_1.mappingRuleAssignmentUnavailable === false, 'the cluster accepts mapping-rule assignments');
|
|
147
|
+
const role = (0, beans_1.newRole)();
|
|
148
|
+
await (0, assertions_1.assertCreated)(await api.post('/roles', { body: role, tenant: 'none' }));
|
|
149
|
+
resources.track('role', role.roleId);
|
|
150
|
+
const group = (0, beans_1.newGroup)();
|
|
151
|
+
await (0, assertions_1.assertCreated)(await api.post('/groups', { body: group, tenant: 'none' }));
|
|
152
|
+
resources.track('group', group.groupId);
|
|
153
|
+
const rule = (0, beans_1.newMappingRule)();
|
|
154
|
+
await (0, assertions_1.assertCreated)(await api.post('/mapping-rules', { body: rule, tenant: 'none' }));
|
|
155
|
+
resources.track('mappingRule', rule.mappingRuleId);
|
|
156
|
+
const toRole = await api.put('/roles/{roleId}/mapping-rules/{mappingRuleId}', {
|
|
157
|
+
params: { roleId: role.roleId, mappingRuleId: rule.mappingRuleId },
|
|
158
|
+
tenant: 'none',
|
|
159
|
+
});
|
|
160
|
+
await (0, assertions_1.assertStatusIn)(toRole, [403], 'no identity provider to map from');
|
|
161
|
+
const toGroup = await api.put('/groups/{groupId}/mapping-rules/{mappingRuleId}', {
|
|
162
|
+
params: { groupId: group.groupId, mappingRuleId: rule.mappingRuleId },
|
|
163
|
+
tenant: 'none',
|
|
164
|
+
});
|
|
165
|
+
await (0, assertions_1.assertStatusIn)(toGroup, [403], 'no identity provider to map from');
|
|
166
|
+
});
|
|
167
|
+
});
|
|
137
168
|
api_1.test.describe('Tenant membership for clients', () => {
|
|
138
169
|
(0, api_1.test)('assigns and removes a client', async ({ api, resources }) => {
|
|
139
170
|
const tenant = (0, beans_1.newTenant)();
|
|
@@ -53,6 +53,14 @@ export declare const usersApiUnavailable: string | false;
|
|
|
53
53
|
* independently, and c8Run differs on all three.
|
|
54
54
|
*/
|
|
55
55
|
export declare const unauthenticatedAccessAllowed: string | false;
|
|
56
|
+
/**
|
|
57
|
+
* Reason text for the mapping-rule assignment gate, or `false` where roles
|
|
58
|
+
* and groups accept a mapping rule.
|
|
59
|
+
*
|
|
60
|
+
* Paired with the 403 assertion in `membership-api-tests.spec.ts`, so a
|
|
61
|
+
* cluster read as refusing that in fact accepts goes red.
|
|
62
|
+
*/
|
|
63
|
+
export declare const mappingRuleAssignmentUnavailable: string | false;
|
|
56
64
|
export declare const enforcementPrincipalUnavailable: string | false;
|
|
57
65
|
/**
|
|
58
66
|
* Reason text for the gRPC gate, or `false` when the run names a gateway.
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* red.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.componentUnavailable = exports.readAuthorizationsEnabled = exports.absentUserMembership = exports.grpcUnavailable = exports.enforcementPrincipalUnavailable = exports.unauthenticatedAccessAllowed = exports.usersApiUnavailable = void 0;
|
|
25
|
+
exports.componentUnavailable = exports.readAuthorizationsEnabled = exports.absentUserMembership = exports.grpcUnavailable = exports.enforcementPrincipalUnavailable = exports.mappingRuleAssignmentUnavailable = exports.unauthenticatedAccessAllowed = exports.usersApiUnavailable = void 0;
|
|
26
26
|
const config_1 = require("./config");
|
|
27
27
|
/**
|
|
28
28
|
* Reason text for the `/v2/users/**` gate, or `false` when the tree is served.
|
|
@@ -62,6 +62,18 @@ exports.unauthenticatedAccessAllowed = config_1.apiConfig.authenticationRequired
|
|
|
62
62
|
: 'this cluster serves /v2 without authentication (AUTHENTICATION_REQUIRED ' +
|
|
63
63
|
'is false), so a request carrying no credentials is answered normally ' +
|
|
64
64
|
'and the 401 this test asserts cannot occur — see tests/api/README.md';
|
|
65
|
+
/**
|
|
66
|
+
* Reason text for the mapping-rule assignment gate, or `false` where roles
|
|
67
|
+
* and groups accept a mapping rule.
|
|
68
|
+
*
|
|
69
|
+
* Paired with the 403 assertion in `membership-api-tests.spec.ts`, so a
|
|
70
|
+
* cluster read as refusing that in fact accepts goes red.
|
|
71
|
+
*/
|
|
72
|
+
exports.mappingRuleAssignmentUnavailable = config_1.apiConfig.mappingRuleAssignmentEnabled
|
|
73
|
+
? false
|
|
74
|
+
: 'this cluster has no external identity provider, so assigning a ' +
|
|
75
|
+
'mapping rule to a role or group answers 403 ' +
|
|
76
|
+
'(MAPPING_RULE_ASSIGNMENT_ENABLED is false) — see tests/api/README.md';
|
|
65
77
|
/**
|
|
66
78
|
* Whether the enforcement tests can obtain a second, unprivileged principal.
|
|
67
79
|
*
|
|
@@ -84,6 +84,16 @@ export interface ApiConfig {
|
|
|
84
84
|
* wherever the variable is unset.
|
|
85
85
|
*/
|
|
86
86
|
authenticationRequired: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Whether mapping rules can be assigned to roles and groups
|
|
89
|
+
* (`MAPPING_RULE_ASSIGNMENT_ENABLED`).
|
|
90
|
+
*
|
|
91
|
+
* SaaS rejects those assignments with 403 until the cluster is connected to
|
|
92
|
+
* an external identity provider, while the mapping-rules API itself still
|
|
93
|
+
* works (camunda-docs `components/admin/mapping-rules.md`). Defaults to
|
|
94
|
+
* `true`, so every deployment that does not set it keeps the coverage.
|
|
95
|
+
*/
|
|
96
|
+
mappingRuleAssignmentEnabled: boolean;
|
|
87
97
|
/**
|
|
88
98
|
* A second OAuth2 client used as the *unprivileged* principal by the
|
|
89
99
|
* authorization enforcement tests.
|
package/dist/utils/api/config.js
CHANGED
|
@@ -40,6 +40,7 @@ function loadApiConfig() {
|
|
|
40
40
|
usersApiEnabled: env('USERS_API_ENABLED', String(authMethod !== 'oauth2')) === 'true',
|
|
41
41
|
authorizationsEnabled: env('AUTHORIZATIONS_ENABLED', 'true') === 'true',
|
|
42
42
|
authenticationRequired: env('AUTHENTICATION_REQUIRED', 'true') === 'true',
|
|
43
|
+
mappingRuleAssignmentEnabled: env('MAPPING_RULE_ASSIGNMENT_ENABLED', 'true') === 'true',
|
|
43
44
|
secondaryClient: {
|
|
44
45
|
clientId: env('SECONDARY_CLIENT_ID'),
|
|
45
46
|
clientSecret: env('SECONDARY_CLIENT_SECRET'),
|