summaryrefslogtreecommitdiff
path: root/api-ref/source/v3/authenticate-v3.inc
blob: 6e3cc62abf067804fd3c4d0c5c2a66b3b89f027e (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
.. -*- rst -*-

=====================================
 Authentication and token management
=====================================

The Identity service generates tokens in exchange for authentication
credentials. A token represents the authenticated identity of a user and,
optionally, grants authorization on a specific project, domain, or the
deployment system.

The body of an authentication request must include a payload that
specifies the authentication methods, which are normally just ``password`` or
``token``, the credentials, and, optionally, the authorization
scope. You can scope a token to a project, domain, the deployment system, or
the token can be unscoped. You cannot scope a token to multiple scope targets.

Tokens have IDs, which the Identity API returns in the
``X-Subject-Token`` response header.

In the case of multi-factor authentication (MFA) more than one authentication
method needs to be supplied to authenticate. As of v3.12 a failure due to MFA
rules only partially being met will result in an auth receipt ID being returned
in the response header ``Openstack-Auth-Receipt``, and a response body that
details the receipt itself and the missing authentication methods. Supplying
the auth receipt ID in the ``Openstack-Auth-Receipt`` header in a follow-up
authentication request, with the missing authentication methods, will result in
a valid token by reusing the successful methods from the first request. This
allows MFA authentication to be a multi-step process.

After you obtain an authentication token, you can:

- Make REST API requests to other OpenStack services. You supply the
  ID of your authentication token in the ``X-Auth-Token`` request
  header.

- Validate your authentication token and list the domains, projects,
  roles, and endpoints that your token gives you access to.

- Use your token to request another token scoped for a different
  domain and project.

- Force the immediate revocation of a token.

- List revoked public key infrastructure (PKI) tokens.

In v3.7 of the Identity API service, two new configuration options
were added: ``[resource] admin_project_name`` and
``[resource] admin_project_domain_name``. The options represent the
project that only the cloud administrator should be able to access.
When an authentication request for a token scoped to the admin project
is processed, it will have an additional field in the token
``{is_admin_project: True}``. The additional field can be used when
writing policy rules that evaluate access control to APIs.

Alternatively, in v3.10 the Identity API service introduced the concept of
system role assignments and system-scoped tokens. APIs that affect the
deployment system require system-scoped tokens.

The Identity API considers expired tokens as invalid, which is determined by
the deployment's configuration.

These authentication errors can occur:

**Authentication errors**

+------------------------+----------------------------------------------------------------------+
| Response code          | Description                                                          |
+------------------------+----------------------------------------------------------------------+
| ``Bad Request (400)``  | The Identity service failed to parse the request as expected. One    |
|                        | of the following errors occurred:                                    |
|                        |                                                                      |
|                        | - A required attribute was missing.                                  |
|                        |                                                                      |
|                        | - An attribute that is not allowed was specified, such as an ID on a |
|                        |   POST request in a basic CRUD operation.                            |
|                        |                                                                      |
|                        | - An attribute of an unexpected data type was specified.             |
+------------------------+----------------------------------------------------------------------+
| ``Unauthorized (401)`` | One of the following errors occurred:                                |
|                        |                                                                      |
|                        | - Authentication was not performed.                                  |
|                        |                                                                      |
|                        | - The specified ``X-Auth-Token`` header is not valid.                |
|                        |                                                                      |
|                        | - The authentication credentials are not valid.                      |
|                        |                                                                      |
|                        | - Not all MFA rules were satisfied.                                  |
|                        |                                                                      |
|                        | - The specified ``Openstack-Auth-Receipt`` header is not valid.      |
+------------------------+----------------------------------------------------------------------+
| ``Forbidden (403)``    | The identity was successfully authenticated but it is not            |
|                        | authorized to perform the requested action.                          |
+------------------------+----------------------------------------------------------------------+
| ``Not Found (404)``    | An operation failed because a referenced entity cannot be found by   |
|                        | ID. For a POST request, the referenced entity might be specified in  |
|                        | the request body rather than in the resource path.                   |
+------------------------+----------------------------------------------------------------------+
| ``Conflict (409)``     | A POST or PATCH operation failed. For example, a client tried to     |
|                        | update a unique attribute for an entity, which conflicts with that   |
|                        | of another entity in the same collection.                            |
|                        |                                                                      |
|                        | Or, a client issued a create operation twice on a collection with a  |
|                        | user-defined, unique attribute. For example, a client made a POST    |
|                        | ``/users`` request two times for the unique, user-defined name       |
|                        | attribute for a user entity.                                         |
+------------------------+----------------------------------------------------------------------+


Password authentication with unscoped authorization
===================================================

.. rest_method::  POST /v3/auth/tokens

Authenticates an identity and generates a token. Uses the password authentication method. Authorization is unscoped.

The request body must include a payload that specifies the
authentication method, which is ``password``, and the user, by ID
or name, and password credentials.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - nocatalog: nocatalog
   - domain: domain
   - name: user_name
   - auth: auth
   - user: user
   - password: password
   - id: user_id
   - identity: identity
   - methods: auth_methods_passwd

Example
~~~~~~~

.. literalinclude:: ./samples/admin/auth-password-unscoped-request-with-domain.json
   :language: javascript

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Subject-Token: X-Subject-Token
   - domain: domain
   - methods: auth_methods_passwd
   - expires_at: expires_at
   - token: token
   - user: user
   - audit_ids: audit_ids
   - issued_at: issued_at
   - id: user_id
   - name: user_name

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 201

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404

Example
~~~~~~~

.. literalinclude:: ./samples/admin/auth-password-unscoped-response.json
   :language: javascript


Password authentication with scoped authorization
=================================================

.. rest_method::  POST /v3/auth/tokens

Authenticates an identity and generates a token. Uses the password
authentication method and scopes authorization to a project, domain, or the
system.

The request body must include a payload that specifies the ``password``
authentication method which includes the credentials in addition to a
``project``, ``domain``, or ``system`` authorization scope.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - nocatalog: nocatalog
   - name: user_name
   - auth: auth
   - user: user
   - scope: scope_string
   - password: password
   - id: user_id
   - identity: identity
   - methods: auth_methods_passwd

System-Scoped Example
~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/system-password.json
   :language: javascript

Domain-Scoped with Domain ID Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/domain-id-password.json
   :language: javascript

Domain-Scoped with Domain Name Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/domain-name-password.json
   :language: javascript

Project-Scoped with Project ID Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/project-id-password.json
   :language: javascript

Project-Scoped with Project Name Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/project-name-password.json
   :language: javascript

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Subject-Token: X-Subject-Token
   - region_id: region_id_required
   - methods: auth_methods_passwd
   - roles: roles
   - url: endpoint_url
   - region: endpoint_region
   - token: token
   - expires_at: expires_at
   - system: system_scope_response_body_optional
   - domain: domain_scope_response_body_optional
   - project: project_scope_response_body_optional
   - issued_at: issued_at
   - catalog: catalog
   - user: user
   - audit_ids: audit_ids
   - interface: endpoint_interface
   - endpoints: endpoints
   - type: endpoint_type
   - id: user_id
   - name: user_name

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 201

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404

System-Scoped Example
~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/system-scoped-password.json
   :language: javascript

Domain-Scoped Example
~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/domain-scoped-password.json
   :language: javascript

Project-Scoped Example
~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/project-scoped-password.json
   :language: javascript

Password authentication with explicit unscoped authorization
============================================================

.. rest_method::  POST /v3/auth/tokens

Authenticates an identity and generates a token. Uses the password authentication method with explicit unscoped authorization.

The request body must include a payload that specifies the
``password`` authentication method, the credentials, and the
``unscoped`` authorization scope.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - nocatalog: nocatalog
   - name: user_name
   - auth: auth
   - user: user
   - scope: explicit_unscoped_string
   - password: password
   - id: user_id
   - identity: identity
   - methods: auth_methods_passwd

Example
~~~~~~~

.. literalinclude:: ./samples/admin/auth-password-explicit-unscoped-request.json
   :language: javascript

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Subject-Token: X-Subject-Token
   - domain: domain
   - methods: auth_methods_passwd
   - roles: roles
   - expires_at: expires_at
   - token: token
   - user: user
   - audit_ids: audit_ids
   - issued_at: issued_at
   - id: user_id
   - name: user_name

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 201

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 404

Example
~~~~~~~

.. literalinclude:: ./samples/admin/auth-password-explicit-unscoped-response.json
   :language: javascript


Token authentication with unscoped authorization
================================================

.. rest_method::  POST /v3/auth/tokens

Authenticates an identity and generates a token. Uses the token authentication method. Authorization is unscoped.

In the request body, provide the token ID.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - nocatalog: nocatalog
   - identity: identity
   - token: auth_token
   - id: auth_token_id
   - auth: auth
   - methods: auth_methods_token

Example
~~~~~~~

.. literalinclude:: ./samples/admin/auth-token-unscoped-request.json
   :language: javascript

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Subject-Token: X-Subject-Token

Status Codes
~~~~~~~~~~~~
.. rest_status_code:: success status.yaml

   - 201

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404

Example
~~~~~~~

.. literalinclude:: ./samples/admin/auth-token-unscoped-response.json
   :language: javascript


Token authentication with scoped authorization
==============================================

.. rest_method::  POST /v3/auth/tokens

Authenticates an identity and generates a token. Uses the token authentication
method and scopes authorization to a project, domain, or the system.

The request body must include a payload that specifies the ``token``
authentication method which includes the token in addition to a ``project``,
``domain``, or ``system`` authorization scope.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - nocatalog: nocatalog
   - methods: auth_methods_token
   - auth: auth
   - token: auth_token
   - audit_ids: audit_ids
   - scope: scope_string
   - id: auth_token_id
   - identity: identity

System-Scoped Example
~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/system-token.json
   :language: javascript

Domain-Scoped with Domain ID Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/domain-id-token.json
   :language: javascript

Domain-Scoped with Domain Name Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/domain-name-token.json
   :language: javascript

Project-Scoped with Project ID Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/project-id-token.json
   :language: javascript

Project-Scoped with Project Name Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/requests/project-name-token.json
   :language: javascript

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Subject-Token: X-Subject-Token
   - region_id: region_id_required
   - methods: auth_methods_passwd
   - roles: roles
   - url: endpoint_url
   - region: endpoint_region
   - token: token
   - expires_at: expires_at
   - system: system_scope_response_body_optional
   - domain: domain_scope_response_body_optional
   - project: project_scope_response_body_optional
   - issued_at: issued_at
   - catalog: catalog
   - user: user
   - audit_ids: audit_ids
   - interface: endpoint_interface
   - endpoints: endpoints
   - type: endpoint_type
   - id: user_id
   - name: user_name

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 201

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404

System-Scoped Example
~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/system-scoped-token.json
   :language: javascript

Domain-Scoped Example
~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/domain-scoped-token.json
   :language: javascript

Project-Scoped Example
~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/project-scoped-token.json
   :language: javascript

Token authentication with explicit unscoped authorization
=========================================================

.. rest_method::  POST /v3/auth/tokens

Authenticates an identity and generates a token.
Uses the token authentication method with explicit unscoped authorization.

In the request body, provide the token ID and the
``unscoped`` authorization scope.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - nocatalog: nocatalog
   - methods: auth_methods_token
   - auth: auth
   - token: auth_token
   - audit_ids: audit_ids
   - scope: explicit_unscoped_string
   - id: auth_token_id
   - identity: identity

Example
~~~~~~~

.. literalinclude:: ./samples/admin/auth-token-explicit-unscoped-request.json
   :language: javascript

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Subject-Token: X-Subject-Token

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 201

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 404

Example
~~~~~~~

.. literalinclude:: ./samples/admin/auth-token-unscoped-response.json
   :language: javascript


Multi-Step authentication (2-Factor Password and TOTP example)
==============================================================

.. rest_method::  POST /v3/auth/tokens

Authenticates an identity and generates a token. Uses the password
authentication method, then the totp method, with an auth receipt in between.

This assumes that MFA has been enabled for the user, and a rule has been
defined requiring authentication with both password and totp.

The first request body must at least include a payload that specifies one of
``password`` or ``totp`` authentication methods which includes the credentials
in addition to an optional scope. If only one method is supplied then an auth
receipt will be returned. Scope is not retained in the receipt and must be
resupplied in subsequent requests.

While it is very possible to supply all the required auth methods at once, this
example shows the multi-step process which is likely to be more common.

More than 2 factors can be used but the same process applies to those as well;
either all auth methods are supplied at once, or in steps with one or more auth
receipts in between.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

First Request
-------------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

  - nocatalog: nocatalog
  - name: user_name
  - auth: auth
  - user: user
  - scope: scope_string
  - password: password
  - id: user_id
  - identity: identity
  - methods: auth_methods_passwd

Example
~~~~~~~

.. literalinclude:: ./samples/auth/requests/project-id-password.json
   :language: javascript

Response
--------

Here we are expecting a 401 status, and a returned auth receipt.

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

  - Openstack-Auth-Receipt: Openstack-Auth-Receipt
  - methods: auth_methods_receipt
  - expires_at: receipt_expires_at
  - issued_at: receipt_issued_at
  - user: user
  - required_auth_methods: required_auth_methods

Status Code
~~~~~~~~~~~

.. rest_status_code:: success status.yaml

  - 401: auth_receipt

.. rest_status_code:: error status.yaml

  - 400
  - 401: auth_failed
  - 403
  - 404

Auth Receipt Example
~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/auth-receipt-password.json
   :language: javascript

Second Request
--------------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

  - Openstack-Auth-Receipt: Openstack-Auth-Receipt
  - nocatalog: nocatalog
  - name: user_name
  - auth: auth
  - user: user
  - scope: scope_string
  - totp: totp
  - id: user_id
  - identity: identity
  - methods: auth_methods_totp

Example
~~~~~~~

.. literalinclude:: ./samples/auth/requests/project-id-totp.json
   :language: javascript

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

  - X-Subject-Token: X-Subject-Token
  - region_id: region_id_required
  - methods: auth_methods_passwd
  - roles: roles
  - url: endpoint_url
  - region: endpoint_region
  - token: token
  - expires_at: expires_at
  - system: system_scope_response_body_optional
  - domain: domain_scope_response_body_optional
  - project: project_scope_response_body_optional
  - issued_at: issued_at
  - catalog: catalog
  - user: user
  - audit_ids: audit_ids
  - interface: endpoint_interface
  - endpoints: endpoints
  - type: endpoint_type
  - id: user_id
  - name: user_name

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

  - 201

.. rest_status_code:: error status.yaml

  - 400
  - 401: auth_receipt_failure
  - 403
  - 404

Project-Scoped Password and TOTP Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/project-scoped-password-totp.json
  :language: javascript


Validate and show information for token
=======================================

.. rest_method::  GET /v3/auth/tokens

Validates and shows information for a token, including its expiration date and authorization scope.

Pass your own token in the ``X-Auth-Token`` request header.

Pass the token that you want to validate in the ``X-Subject-Token``
request header.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Auth-Token: X-Auth-Token
   - X-Subject-Token: X-Subject-Token
   - nocatalog: nocatalog
   - allow_expired: allow_expired

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Subject-Token: X-Subject-Token
   - methods: auth_methods
   - links: domain_link_response_body
   - user: user
   - token: token
   - expires_at: expires_at
   - catalog: catalog_response_body_optional
   - system: system_scope_response_body_optional
   - domain: domain_scope_response_body_optional
   - project: project_scope_response_body_optional
   - roles: roles
   - audit_ids: audit_ids
   - issued_at: issued_at
   - id: user_id
   - name: user_name

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404

Unscoped Example
~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/unscoped-password.json
   :language: javascript

System-Scoped Example
~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/system-scoped-password.json
   :language: javascript

Domain-Scoped Example
~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/domain-scoped-password.json
   :language: javascript

Project-Scoped Example
~~~~~~~~~~~~~~~~~~~~~~

.. literalinclude:: ./samples/auth/responses/project-scoped-password.json
   :language: javascript

Check token
===========

.. rest_method::  HEAD /v3/auth/tokens

Validates a token.

This call is similar to ``GET /auth/tokens`` but no response body
is provided even in the ``X-Subject-Token`` header.

The Identity API returns the same response as when the subject
token was issued by ``POST /auth/tokens`` even if an error occurs
because the token is not valid. An HTTP ``204`` response code
indicates that the ``X-Subject-Token`` is valid.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Auth-Token: X-Auth-Token
   - X-Subject-Token: X-Subject-Token
   - allow_expired: allow_expired

Response
--------

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404

Revoke token
============

.. rest_method::  DELETE /v3/auth/tokens

Revokes a token.

This call is similar to the HEAD ``/auth/tokens`` call except that
the ``X-Subject-Token`` token is immediately not valid, regardless
of the ``expires_at`` attribute value. An additional
``X-Auth-Token`` is not required.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_tokens``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Auth-Token: X-Auth-Token
   - X-Subject-Token: X-Subject-Token

Response
--------

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 201

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404

Get service catalog
===================

.. rest_method:: GET /v3/auth/catalog

New in version 3.3

This call returns a service catalog for the X-Auth-Token provided in the
request, even if the token does not contain a catalog itself (for example,
if it was generated using ?nocatalog).

The structure of the catalog object is identical to that contained in a token.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_catalog``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Auth-Token: X-Auth-Token

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - endpoints: endpoints
   - id: service_id
   - type: service_type
   - name: service_name

Status Codes
~~~~~~~~~~~~


.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404
   - 405
   - 409
   - 413
   - 415
   - 503

Example
~~~~~~~

.. literalinclude:: ./samples/admin/get-service-catalog-response.json
   :language: javascript


Get available project scopes
============================

.. rest_method:: GET /v3/auth/projects

New in version 3.3

This call returns the list of projects that are available to be scoped
to based on the X-Auth-Token provided in the request.

The structure of the response is exactly the same as listing projects
for a user.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_projects``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Auth-Token: X-Auth-Token

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - domain_id: project_domain_id_response_body
   - enabled: project_enabled_response_body
   - id: project_id
   - links: links_project
   - name: project_name_response_body

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404
   - 405
   - 409
   - 413
   - 415
   - 503

Example
~~~~~~~

.. literalinclude:: ./samples/admin/get-available-project-scopes-response.json
   :language: javascript


Get available domain scopes
===========================

.. rest_method:: GET /v3/auth/domains

New in version 3.3

This call returns the list of domains that are available to be scoped
to based on the X-Auth-Token provided in the request.

The structure is the same as listing domains.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_domains``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Auth-Token: X-Auth-Token

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - description: domain_description_response_body
   - enabled: domain_enabled_response_body
   - id: domain_id_response_body
   - links: domain_link_response_body
   - name: domain_name_response_body

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404
   - 405
   - 409
   - 413
   - 415
   - 503

Example
~~~~~~~

.. literalinclude:: ./samples/admin/get-available-domain-scopes-response.json
   :language: javascript

Get available system scopes
===========================

.. rest_method:: GET /v3/auth/system

New in version 3.10

This call returns the list of systems that are available to be scoped
to based on the X-Auth-Token provided in the request.

Relationship: ``https://docs.openstack.org/api/openstack-identity/3/rel/auth_system``

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Auth-Token: X-Auth-Token

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - links: domain_link_response_body
   - system: response_body_system_required

Status Codes
~~~~~~~~~~~~

.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 401
   - 400

Example
~~~~~~~

.. literalinclude:: ./samples/admin/get-available-system-scopes-response.json
   :language: javascript