-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathAPI.yml
More file actions
4184 lines (3400 loc) · 133 KB
/
Copy pathAPI.yml
File metadata and controls
4184 lines (3400 loc) · 133 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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
global:
errors:
none: &none []
internal: &internal |
an internal error occurred and should be investigated by the
site administrators
e401: &e401
message: Authorization required
summary: |
The request was made without an authenticated session or auth token.
See **Authentication** for more details. The request may be retried
after authentication.
e403: &e403
message: Access denied
summary: |
The requester lacks sufficient tenant or system role assignment.
Refer to the **Access Control** subsection, above.
The request should not be retried.
intro: |
# SHIELD v2 API
This document specifies the behavior of the SHIELD API, version 2,
in its entirety. This is a specification, not merely
documentation — it is the authoritative source. If this
document is unclear, it will be amended. If the SHIELD codebase
disagrees with this specification, the code is incorrect and
should be treated as such.
The purpose of this document is to allow 3rd party integrators to
inter-operate with the SHIELD API without resorting to spelunking
through its implementation.
## Error Handling
The SHIELD API returns errors by using non-200 HTTP status codes,
as follows:
- **500** - An internal error has occurred; details will be
present in the SHIELD Core server error log. The response
will contain a sanitized error message, using the standard
format (described below).
- **400** - Something about the HTTP request was invalid or
incorrect. This may occur if a JSON payload was expected,
but not provided, required keys in theat payload were missing,
or values supplied were incorrect, out-of-range, etc.
- **404** - The requested resource was not found. An error
(in the standard format) will be returned.
- **401** - The requester is not authenticated to the SHIELD
API, but has requested a protected endpoint. The request
may be retried after authenticating.
- **403** - The requester is authenticated but has requested
an endpoint that they do lack the rights to access. This
request should not be retried.
Regardless of the HTTP status code used, the SHIELD API will
always include a JSON payload with more details, in either the
**Standard Format** or the **Missing Values Format**.
### Standard Format for Error Reporting
The **Standard Format** for error reporting consists of a
top-level JSON object containing a single key, `error`, that
contains a human-readable error message, suitable for display.
Example:
{
"error": "No such retention policy"
}
This format is used for all non-validation error reporting.
### Missing Values Format for Error Reporting
The **Missing Values Format** for error reporting is used for
reporting request validation errors where required fields in the
request payload are missing. It consists of a top-level JSON
object containing a single key, `missing`, which is set to a list
of field names that must be sent in the request, but were not.
Example:
{
"missing": [
"name",
"endpoint",
"agent"
]
}
The order of the fields is inconsequential.
sections:
- name: Health & Informational
intro: |
The health and informational endpoints give you a glimpse into the
well-being of a SHIELD Core, for monitoring purposes, at various
levels of detail.
endpoints:
- name: GET /v2/info # {{{
intro: |
Returns minimal information necessary for forward-compatibility
with different versions of SHIELD Core and clients.
access: ~
response:
json: |
{
"version" : "6.7.2",
"env" : "PRODUCTION",
"color" : "yellow",
"motd" : "Welcome to S.H.I.E.L.D.",
"ip" : "10.0.0.5",
"api" : 2
}
summary: |
{{JSON}}
The `version` key only shows up if the request was made in the
context of an authenticated session.
The `env` key is configurable by the SHIELD site administrator,
at deployment / boot time.
Similar to env, the `color` key is configurable by the SHIELD site
administrator, used to visually differentiate various SHIELD
deployments in the WebUI.
The `motd` is what is displayed upon login, and can be changed by
the SHIELD site administrator.
The `ip` key is the ip of the SHIELD core.
The `api` key is a single integer that identifies which version
of the SHIELD API this core implements. Currently, there are
two possible values:
- **2** - The `/v2` endpoints are present, but not `/v1`
- **1** - Only the `/v1` endpoints are present (legacy).
errors: *none
# }}}
- name: GET /v2/bearings # {{{
intro: |
Returns a baseline set of information about the data related to the
current session's view of SHIELD, including targets, jobs, stores for
all assigned tenants, and global storage.
access: any
response:
json: |
{
"vault" : "unlocked",
"shield" : {
"version" : "6.7.2",
"env" : "PRODUCTION",
"color" : "yellow",
"motd" : "Welcome to S.H.I.E.L.D.",
"ip" : "10.0.0.5",
"api" : 2
},
"user" : {
"uuid" : "229db66f-ad6b-40ee-b0c9-36b3eb957503",
"name" : "Persephone Jones",
"account" : "pjones",
"backend" : "local",
"sysrole" : "technician",
"default_tenant" : "c76869df-3535-4a59-b33b-2f650e660bf1"
},
"stores": [
{
"uuid" : "8f4dd8c4-9677-4660-ad53-b0a5b718628c",
"name" : "Global Storage",
"summary" : "Global Storage, for use by any and all",
"global" : true,
"agent" : "127.0.0.1:5444",
"plugin" : "webdav",
"healthy" : true,
"archive_count" : 0,
"storage_used" : 0,
"threshold" : 0,
"daily_increase" : 0,
"config": {
"url": "http://localhost:8182"
},
"last_test_task_uuid": ""
}
],
"tenants" : {
"c76869df-3535-4a59-b33b-2f650e660bf1" : {
"tenant" : {
"uuid" : "c76869df-3535-4a59-b33b-2f650e660bf1",
"name" : "My Tenant",
"archive_count" : 0,
"storage_used" : 0,
"daily_increase" : 0
},
"role" : "admin",
"grants" : {
"admin" : true,
"engineer" : true,
"operator" : true
},
"archives": [],
"jobs": [
{
"uuid" : "c623b8bf-b631-43ee-bb44-949454702716",
"name" : "Hourly",
"summary" : "",
"keep_n" : 48,
"keep_days" : 2,
"retries" : 2,
"schedule" : "hourly at :05",
"paused" : true,
"agent" : "127.0.0.1:5444",
"fixed_key" : false,
"healthy" : false,
"last_run" : 1543328457,
"last_task_status" : "canceled",
"target" : {
"uuid" : "5c180612-05e8-4ae6-9046-9d40d50d1a3c",
"name" : "SHIELD",
"agent" : "",
"plugin" : "fs",
"compression" : "bzip2",
"endpoint" : "{\"base_dir\":\"/e/no/ent\",\"bsdtar\":\"bsdtar\",\"exclude\":\"var/*.db\"}"
},
"store" : {
"uuid" : "a5d64d9e-acc7-4621-8489-2ede2d3b31bf",
"name" : "CloudStor",
"summary" : "A temporary store for the dev environment.",
"healthy" : true,
"agent" : "",
"plugin" : "webdav",
"endpoint" : "{\"url\":\"http://localhost:8182\"}"
}
}
],
"targets" : [
{
"uuid" : "5c180612-05e8-4ae6-9046-9d40d50d1a3c",
"name" : "SHIELD",
"summary" : "The working directory of the dev environment.",
"compression" : "bzip2",
"agent" : "127.0.0.1:5444",
"plugin" : "fs",
"config" : {
"base_dir" : "/e/no/ent",
"bsdtar" : "bsdtar",
"exclude" : "var/*.db"
}
}
],
"stores" : [
{
"uuid" : "a5d64d9e-acc7-4621-8489-2ede2d3b31bf",
"name" : "CloudStor",
"summary" : "A temporary store for the dev environment.",
"global" : false,
"healthy" : true,
"archive_count" : 0,
"storage_used" : 0,
"daily_increase" : 0,
"threshold" : 0,
"agent" : "127.0.0.1:5444",
"plugin" : "webdav",
"config" : {
"url": "http://localhost:8182"
},
"last_test_task_uuid": "4320b06d-dd3d-4c00-a2cd-9fec9b2520d6"
}
]
}
}
}
summary: |
{{JSON}}
FIXME
errors: *none
# }}}
- name: GET /v2/health # {{{
intro: |
Returns health information about the SHIELD Core, connected
storage accounts, and general metrics, at a global scope.
access: any
response:
summary: |
If all goes well, you will receive a 200 OK, with a `Content-Type`
of `application/json`, and something similar to the following JSON
payload in the response body:
{{JSON}}
json: |
{
"health": {
"core" : "unsealed",
"storage_ok" : true,
"jobs_ok" : true
},
"storage": [
{ "name": "s3", "healthy": true },
{ "name": "fs", "healthy": true } ],
"jobs": [
{
"uuid" : "3dc875a4-042c-47a1-828c-1d927455c6c7",
"target" : "BOSH DB",
"job" : "daily",
"healthy" : true
},
{
"uuid" : "d9a4547e-c1e7-4869-bb8d-4abb757b2f70",
"target" : "BOSH DB",
"job" : "weekly",
"healthy" : true
}
],
"stats": {
"jobs" : 8,
"systems" : 7,
"archives": 124,
"storage" : 243567112,
"daily" : 12345000
}
}
errors:
- message: Unable to check SHIELD health
summary: *internal
# }}}
- name: GET /v2/tenants/:tenant/health # {{{
intro: |
Returns health information about the SHIELD Core, connected
storage accounts, and general metrics, restricted to the scope
visible to a single tenant.
access: [tenant, operator]
response:
summary: |
If all goes well, you will receive a 200 OK, with a `Content-Type`
of `application/json`, and something similar to the following JSON
payload in the response body:
{{JSON}}
json: |
{
"health": {
"core" : "unsealed",
"storage_ok" : true,
"jobs_ok" : true
},
"storage": [
{ "name": "s3", "healthy": true },
{ "name": "fs", "healthy": true } ],
"jobs": [
{
"uuid" : "3dc875a4-042c-47a1-828c-1d927455c6c7",
"target" : "BOSH DB",
"job" : "daily",
"healthy" : true
},
{
"uuid" : "d9a4547e-c1e7-4869-bb8d-4abb757b2f70",
"target" : "BOSH DB",
"job" : "weekly",
"healthy" : true
}
],
"stats": {
"jobs" : 8,
"systems" : 7,
"archives": 124,
"storage" : 243567112,
"daily" : 12345000
}
}
errors:
- message: Unable to check SHIELD health
summary: *internal
# }}}
- name: SHIELD Authentication
intro: |
The Authentication endpoints allow clients to authenticate to a
SHIELD Core, providing credentials to prove their identity and
their authorization to perform other tasks inside of SHIELD.
endpoints:
- name: POST /v2/auth/login # {{{
intro: |
Authenticate against the SHIELD API as a local user, and retrieve
a session ID that can be used for future, authenticated,
interactions.
access: ~
request:
json: |
{
"username": "your-username",
"password": "your-password"
}
summary: |
{{CURL}}
**NOTE:** `password` is sent in cleartext, so SHIELD should aways be
communicating over TLS (HTTPS).
Both fields, `username`, and `password`, are required.
response:
json: |
{
"ok": "95cca9ea-d2e6-4966-b071-9df6856a0e55"
}
summary: |
{{JSON}}
The session ID (return under the `ok` key) should be passed on
subsequent requests as proof of authentication. This can be done
by setting the `shield7` cookie to the session ID, or by setting
the `X-Shield-Session` request header.
errors:
- message: Unable to log you in
summary: *internal
- message: Incorrect username or password
summary: |
The supplied credentials were incorrect; either the
user doesn't exist, or the password was wrong.
# }}}
- name: GET /v2/auth/logout # {{{
intro: |
Destroy the current session and log the user out.
access: ~
response:
json: |
{
"ok" : "Successfully logged out"
}
summary: |
{{JSON}}
**NOTE:** The same behavior is exhibited when an authenticated
session successfully logs out, as is seen when an unauthenticated
session attempts to log out.
errors:
- message: Unable to log you out
summary: *internal
# }}}
- name: GET /v2/auth/id # {{{
intro: |
Retrieve identity and authorization information about the
currently authenticated session. If the requester has not
authenticated, a suitable response will be returned.
access: ~
response:
json: |
{
"user": {
"name" : "Your Full Name",
"account" : "username",
"backend" : "SHIELD",
"sysrole" : ""
},
"tenants": [
{
"uuid": "63a8f402-31e6-4503-8fab-66cbcf411ed3",
"name": "Some Random Tenant",
"role": "admin"
},
{
"uuid": "860f7685-c311-4ae5-b34d-6991fc721a37",
"name": "Another Tenant",
"role": "engineer"
}
],
"tenant": {
"uuid": "63a8f402-31e6-4503-8fab-66cbcf411ed3",
"name": "Some Random Tenant",
"role": "admin"
}
}
summary: |
{{JSON}}
The top-level `user` key contains information about the current
authenticated user, including their name and what authentication
provider they came from.
The `tenants` key lists _all_ of the tenants that this user
belongs to, along with the role assigned on each. The session is
free to switch between any of these tenants as they see fit.
The `tenant` key contains the tenant definition for the currently
selected tenant, based on user preferences.
errors:
- message: Authentication failed
summary: |
The request either lacked a session cookie (or an
`X-Shield-Session` header), or some other internal
error has occurred, and SHIELD administrators should
investigate.
# }}}
- name: GET /v2/auth/providers # {{{
intro: |
Retrieve public configuration of SHIELD Authentication Providers,
which can be used by client systems to initiate authentication
against 3rd party systems like Github and Cloud Foundry UAA.
access: ~
response:
json: |
[
{
"name" : "Github(.com)",
"identifier" : "gh",
"type" : "github",
"web_entry" : "/auth/gh/web",
"cli_entry" : "/auth/gh/cli",
"redirect" : "/auth/gh/redir"
}
]
errors: *none
# }}}
- name: GET /v2/auth/providers/:identifier # {{{
intro: |
Retrieve private configuration of a single SHIELD Authentication
Providers, for use by SHIELD administrators. This includes all of
the information from the public endpoint, as well as private
properties including things like client secrets.
access: [system, admin]
response:
json: |
{
"name" : "Github(.com)",
"identifier" : "gh",
"type" : "github",
"web_entry" : "/auth/gh/web",
"cli_entry" : "/auth/gh/cli",
"redirect" : "/auth/gh/redir",
"properties" : {
"secret" : "properties",
"that" : "are",
"provider" : "specific"
}
}
errors:
- message: No such authentication provider
summary: |
No authentication provider was found with the given
identifier.
# }}}
- name: GET /v2/auth/tokens # {{{
intro: |
Retrieve a list of all authentication tokens that have been
generated for use on behalf of the currently authenticated
user. For security reasons, the session ID attached to the
authentication token is not returned.
access: any
response:
json: |
[
{
"uuid" : "bbcb6675-8ec4-4412-93e3-35626860b126",
"name" : "test",
"created_at" : "2017-10-21 00:54:33",
"last_seen" : null
}
]
summary: |
{{JSON}}
The `uuid` key is used strictly for retrieving and revoking each
authentication token; it cannot be used as an authentication token,
as it is not the session ID.
errors:
- message: Authentication failed
summary: |
The request either lacked a session cookie (or an
`X-Shield-Session` header), or some other internal
error has occurred, and SHIELD administrators should
investigate.
- message: Unable to retrieve tokens information
summary: *internal
# }}}
- name: POST /v2/auth/tokens # {{{
intro: |
Generate a new authentication token to act on behalf of the
currently authenticated user.
access: any
request:
json: |
{
"name": "auth-token-name"
}
summary: |
{{CURL}}
Each authentication token requires a name that is unique
to the parent user account.
response:
json: |
{
"uuid" : "bbcb6675-8ec4-4412-93e3-35626860b126",
"session" : "8ef409e9-690d-4d91-9f74-6d657f56843e",
"name" : "test",
"created_at" : "2017-10-21 00:54:33",
"last_seen" : null
}
summary: |
{{JSON}}
The `uuid` key is used strictly for retrieving and revoking each
authentication token; it cannot be used as an authentication token,
as it is not the session ID.
The `session` key should be used
errors:
- message: Authentication failed
summary: |
The request either lacked a session cookie (or an
`X-Shield-Session` header), or some other internal
error has occurred, and SHIELD administrators should
investigate.
- message: Unable to retrieve tokens information
summary: *internal
- message: Unable to generate new token
summary: *internal
# }}}
- name: DELETE /v2/auth/tokens/:uuid # {{{
intro: |
Revoke an authentication token that belongs to the currently
authenticated user (even if its authenticated by the token being
revoked).
access: any
response:
json: |
{
"ok": "Token revoked"
}
summary: |
{{JSON}}
Note that if you have revoked the auth token you were using, all
subsequent requests will fail to authenticated. It makes sense,
but it bears repeating.
errors:
- message: Unable to revoke auth token
summary: *internal
# }}}
- name: GET /v2/auth/sessions # {{{
intro: |
Retrieve a list of all current login sessions
access: [system, admin]
request:
query:
- name: exact
type: bool
summary: |
When filtering sessions, perform either exact field / value
matching (`exact=t`), or fuzzy search (`exact=f`, the
default)
- name: is_token
type: bool
summary: |
When filtering sessions, include those associated with tokens (default - false)
- name: uuid
type: uuid
summary: |
Only show the session that matches the given UUID.
This is a FIXME - we probably need to remove this.
- name: user_uuid
type: uuid
summary: |
Only show sessions that matches the given user UUID.
- name: name
type: string
summary: |
Only show sessions whose associated token name match the given value.
Subject to the `exact=(t|f)` query string parameter.
- name: ip_addr
type: string
summary: |
Only show sessions who are associated with the given IP address.
- name: limit
type: number
summary: |
Limit the returned result set to the first _limit_ users
that match the other filtering rules. A limit of `0` (the
default) denotes an unlimited search.
response:
json: |
[
{
"uuid": "cbeffb8d-4d3d-49a1-b4cd-14b344dac1f2",
"user_uuid": "ccc0430b-9d3d-4b1c-a980-dac769f64174",
"created_at": "2017-10-24 16:39:03",
"last_seen_at": "2017-10-24 16:39:03",
"token_uuid": "",
"name": "",
"ip_addr": "127.0.0.1",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
"user_account": "admin",
"current_session": false
}
]
summary: |
{{JSON}}
- **uuid** - The internal UUID assigned to this session by the SHIELD Core.
- **user\_uuid** - The internal UUID corresponding to the user associated with the session.
- **created\_at** - When the user created the session (upon login via WebUI or CLI).
Date is formatted YYYY-MM-DD HH:MM:SS, in 24-hour notation.
- **last\_seen\_at** - When the user last made contact with the
SHIELD Core via an authenticated endpoint.
Date is formatted YYYY-MM-DD HH:MM:SS, in 24-hour notation.
- **token\_uuid** - The uuid of the SHIELD Token associated with the session (if applicable).
- **name** - The name of the SHIELD Token associated with the session (if applicable).
- **ip\_addr** - The originating `IP address` of the user, from the
point-of-view of the SHIELD Core.
- **user\_agent** - The user agent associated with the last request made by the user.
- **user\_account** - The account corresponding to the user associated with the session.
- **current\_session** - Denotes whether the session corresponds to the requesting session.
errors:
- message: Authentication failed
summary: |
The request either lacked a session cookie (or an
`X-Shield-Session` header), or some other internal
error has occurred, and SHIELD administrators should
investigate.
- message: Unable to retrieve session information
summary: *internal
# }}}
- name: GET /v2/auth/sessions/:uuid # {{{
intro: |
Retrieve a single login session
access: [system, admin]
response:
json: |
{
"uuid": "cbeffb8d-4d3d-49a1-b4cd-14b344dac1f2",
"user_uuid": "ccc0430b-9d3d-4b1c-a980-dac769f64174",
"created_at": "2017-10-24 16:39:03",
"last_seen_at": "2017-10-24 16:39:03",
"token_uuid": "",
"name": "",
"ip_addr": "127.0.0.1",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
"user_account": "admin"
}
summary: |
{{JSON}}
- **uuid** - The internal UUID assigned to this session by the SHIELD Core.
- **user\_uuid** - The internal UUID corresponding to the user associated with the session.
- **created\_at** - When the user created the session (upon login via WebUI or CLI).
Date is formatted YYYY-MM-DD HH:MM:SS, in 24-hour notation.
- **last\_seen\_at** - When the user last made contact with the
SHIELD Core via an authenticated endpoint.
Date is formatted YYYY-MM-DD HH:MM:SS, in 24-hour notation.
- **token\_uuid** - The uuid of the SHIELD Token associated with the session (if applicable).
- **name** - The name of the SHIELD Token associated with the session (if applicable).
- **ip\_addr** - The originating `IP address` of the user, from the
point-of-view of the SHIELD Core.
- **user\_agent** - The user agent associated with the last request made by the user.
- **user\_account** - The account corresponding to the user associated with the session.
errors:
- message: Authentication failed
summary: |
The request either lacked a session cookie (or an
`X-Shield-Session` header), or some other internal
error has occurred, and SHIELD administrators should
investigate.
- message: Unable to retrieve session information
summary: *internal
# }}}
- name: DELETE /v2/auth/sessions/:uuid # {{{
intro: |
Revoke a user's session and force them to reauthenticate on next request.
access: [system, admin]
response:
json: |
{
"ok": "Successfully cleared session 'd3092979-5a83-4006-8819-fd1695f9041f' (127.0.0.1)"
}
errors:
- message: Session not found
summary: |
The session given by the URL UUID was not found in the database
- message: Unable to clear session
summary: *internal
- message: Unable to retrieve session information
summary: *internal
# }}}
- name: PATCH /v2/auth/user/settings # {{{
intro: |
Save user settings.
access: any
request:
json: |
{
"default_tenant": "2a03d67b-6146-4716-b10a-42ec073cfb78"
}
response:
json: |
{
"ok" : "Settings saved."
}
errors:
- message: Authentication failed
summary: |
The request either lacked a session cookie (or an
`X-Shield-Session` header), or some other internal
error has occurred, and SHIELD administrators should
investigate.
- message: Unable to save settings
summary: *internal
# }}}
- name: SHIELD Users
intro: |
SHIELD provides both a local user database, and the ability to
map 3rd party systems into the SHIELD tenancy model. These API
endpoints allow you to manage the former, and query the results
of the latter.
endpoints:
- name: GET /v2/auth/local/users # {{{
intro: |
access: [system, manager]
request:
query:
- name: exact
type: bool
summary: |
When filtering users, perform either exact field / value
matching (`exact=t`), or fuzzy search (`exact=f`, the
default)
- name: uuid
type: uuid
summary: |
Only show the local user that matches the given UUID.
This is a FIXME - we probably need to remove this.
- name: account
type: string
summary: |
Only show local users whose account names (usernames)
match the given value. Subject to the `exact=(t|f)` query
string parameter.
- name: sysrole
type: string
summary: |
Only show local users who have been assigned the given
system role.
- name: limit
type: number
summary: |
Limit the returned result set to the first _limit_ users
that match the other filtering rules. A limit of `0` (the
default) denotes an unlimited search.
response:
json: |
[
{
"uuid" : "b30bb2dd-81d4-407f-91eb-a82ed3023218",
"name" : "Full Name",
"account" : "username",
"sysrole" : "engineer",
"tenants": [