-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcondition.yml
More file actions
307 lines (305 loc) · 9.8 KB
/
condition.yml
File metadata and controls
307 lines (305 loc) · 9.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
conditions:
get:
summary: List all Conditions.
description: List all Conditions visible to current user.
tags:
- Conditions
parameters:
- $ref: './common.yml#/parameters/authorization'
- $ref: './common.yml#/parameters/query'
- $ref: './common.yml#/parameters/range'
- $ref: './common.yml#/parameters/orderBy'
- $ref: './common.yml#/parameters/descending'
- $ref: './common.yml#/parameters/filterBy'
responses:
'200':
description: List of Conditions.
content:
application/json:
schema:
$ref: '#/definitions/ConditionList'
'401':
$ref: './common.yml#/responses/TokenError'
'403':
$ref: './common.yml#/responses/PermissionError'
'500':
$ref: './common.yml#/responses/UnexpectedError'
post:
summary: Create a new Condition.
description: Create a new Condition.
tags:
- Conditions
parameters:
- $ref: './common.yml#/parameters/authorization'
responses:
'200':
description: Created Condition.
content:
application/json:
schema:
$ref: '#/definitions/Condition'
'400':
$ref: './common.yml#/responses/JsonError'
'401':
$ref: './common.yml#/responses/TokenError'
'403':
$ref: './common.yml#/responses/PermissionError'
'409':
$ref: './common.yml#/responses/ConflictError'
'422':
$ref: './common.yml#/responses/ValidationError'
'500':
$ref: './common.yml#/responses/UnexpectedError'
requestBody:
$ref: '#/requestBodies/Condition'
conditions-id:
get:
summary: Get a specific Condition.
description: Get a specific Condition.
tags:
- Conditions
parameters:
- $ref: './common.yml#/parameters/authorization'
- $ref: './common.yml#/parameters/id'
responses:
'200':
description: Single Condition.
content:
application/json:
schema:
$ref: '#/definitions/Condition'
'401':
$ref: './common.yml#/responses/TokenError'
'403':
$ref: './common.yml#/responses/PermissionError'
'404':
$ref: './common.yml#/responses/NotFoundError'
'500':
$ref: './common.yml#/responses/UnexpectedError'
put:
summary: Update an existing Condition.
description: Update an existing Condition.
tags:
- Conditions
parameters:
- $ref: './common.yml#/parameters/authorization'
- $ref: './common.yml#/parameters/id'
responses:
'200':
description: Updated Condition.
content:
application/json:
schema:
$ref: '#/definitions/Condition'
'400':
$ref: './common.yml#/responses/JsonError'
'401':
$ref: './common.yml#/responses/TokenError'
'403':
$ref: './common.yml#/responses/PermissionError'
'404':
$ref: './common.yml#/responses/NotFoundError'
'422':
$ref: './common.yml#/responses/ValidationError'
'500':
$ref: './common.yml#/responses/UnexpectedError'
requestBody:
$ref: '#/requestBodies/Condition'
delete:
summary: Delete a specific Condition.
description: Delete a specific Condition.
tags:
- Conditions
parameters:
- $ref: './common.yml#/parameters/authorization'
- $ref: './common.yml#/parameters/id'
responses:
'204':
description: Condition was deleted successfully.
'401':
$ref: './common.yml#/responses/TokenError'
'403':
$ref: './common.yml#/responses/PermissionError'
'404':
$ref: './common.yml#/responses/NotFoundError'
'500':
$ref: './common.yml#/responses/UnexpectedError'
conditions-test:
post:
summary: Simulate a given expression for a Condition, Policy or Criteria Script.
description: Simulate a given expression for a Condition, Policy or Criteria Script.
tags:
- Conditions
parameters:
- $ref: './common.yml#/parameters/authorization'
responses:
'200':
description: Evaluation result.
content:
application/json:
schema:
type: object
properties:
result:
type: boolean
description: Whether the evaluation succeeded or not.
output:
type: string
description: The output logs from the evaluation. Generated by "console.log" and "print" functions.
example: Debug log
error:
type: string
description: The error text. Available if the evaluation has an error.
example: 'Expression does not return boolean. Received: String'
executionMs:
type: number
description: How long it took to evaluate the expression.
example: 201
'400':
$ref: './common.yml#/responses/JsonError'
'401':
$ref: './common.yml#/responses/TokenError'
'403':
$ref: './common.yml#/responses/PermissionError'
'422':
$ref: './common.yml#/responses/ValidationError'
'500':
$ref: './common.yml#/responses/UnexpectedError'
requestBody:
description: The evaluation details.
required: true
content:
application/json:
schema:
$ref: '#/definitions/TestRequest'
requestBodies:
Condition:
content:
application/json:
schema:
$ref: '#/definitions/Condition'
description: Condition object.
required: true
definitions:
ConditionList:
allOf:
- $ref: './common.yml#/definitions/ResultList'
- type: object
description: Represents a list of Conditions.
properties:
data:
type: array
description: List of Conditions.
items:
$ref: '#/definitions/Condition'
Condition:
allOf:
- $ref: './common.yml#/definitions/BaseEntity'
- type: object
description: Represents a Condition.
required:
- expression
properties:
expression:
type: string
description: Boolean expression in JavaScript.
example: |-
var result = false;
if/*password*/(claims.user.hasPassword('test', 60))/*end password*/ { return true; }
return result;
repeatSchedules:
type: array
description: >-
A list of schedules that decides when to reevaluate
the Condition. All the scheduled times will be effective. One
will not override the other.
- It can be a time of the day, e.g. 13:00, 10:25, 2:10 etc.
- It can be one of the predefined
intervals, e.g. 1m, 5m, 15m, 1h. These intervals
will be always rounded up, i.e. if it's 15m and the
time is 12:07 when the Condition is evaluated
first, then the next evaluation will occur at
12:15, and the next one will be at
12:30 and so on.
items:
type: string
example:
- 1h
- '13:32'
remedyLogic:
type: string
description: Whether all the Remedy Methods must succeed to pass this Condition or just one.
enum:
- and
- or
default: and
remedyMethods:
description: The remedy methods that will be triggered if the evaluation fails.
type: array
items:
type: object
required:
- type
- message
properties:
type:
type: string
description: remedy method type.
enum:
- DisplayMessage
- OtpAuthentication
- PasswordAuthentication
- Reason
message:
type: string
description: Message to be shown to the user. Required for all remedy method.
example: This resource requires you to enter your password again
claimSuffix:
type: string
description: >-
Suffix to be added to the claim.
Required for OtpAuthentication, PasswordAuthentication and Reason remedy methods.
example: test
providerId:
type: string
format: uuid
x-uuid-ref: MfaProvider
description: MFA Provider Id. Required for OtpAuthentication remedy method.
example: 4c07bc67-57ea-42dd-b702-c2d6c45419fc
TestRequest:
type: object
required:
- expression
properties:
expression:
type: string
description: The javascript expression to evaluate.
example: "return claims.user.username === 'admin';"
userClaims:
type: object
additionalProperties: true
example:
username: admin
groups:
- 'CN=test,OU=unit,DC=company,DC=com'
- 'CN=finance,OU=unit,DC=company,DC=com'
deviceClaims:
type: object
additionalProperties: true
example:
os:
name: Microsoft Windows 10 Pro
platform: x64
type: desktop
isUserAdmin: true
language: en-us
systemClaims:
type: object
additionalProperties: true
example:
connectTime: '2018-11-16T13:25:15.672Z'
tunIPv4: '15.0.0.24'
clientSrcIp: '192.168.111.184'
time:
type: string
format: date-time