File: application-credentials.inc

package info (click to toggle)
keystone 2%3A28.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,432 kB
  • sloc: python: 125,079; pascal: 2,239; sh: 877; xml: 335; makefile: 216
file content (527 lines) | stat: -rw-r--r-- 13,614 bytes parent folder | download | duplicates (2)
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
.. -*- rst -*-

=======================
Application Credentials
=======================

Application credentials provide a way to delegate a user's authorization to an
application without sharing the user's password authentication. This is a
useful security measure, especially for situations where the user's
identification is provided by an external source, such as LDAP or a
single-sign-on service. Instead of storing user passwords in config files, a
user creates an application credential for a specific project, with all or a
subset of the role assignments they have on that project, and then stores the
application credential identifier and secret in the config file.

Multiple application credentials may be active at once, so you can easily
rotate application credentials by creating a second one, converting your
applications to use it one by one, and finally deleting the first one.

Application credentials are limited by the lifespan of the user that created
them. If the user is deleted, disabled, or loses a role assignment on a
project, the application credential is deleted.

Application credentials can have their privileges limited in two ways. First,
the owner may specify a subset of their own roles that the application
credential may assume when getting a token for a project. For example, if a
user has the ``member`` role on a project, they also have the implied role
``reader`` and can grant the application credential only the ``reader`` role
for the project:

::

    "roles": [
        {"name": "reader"}
    ]

Users also have the option of delegating more fine-grained access control to
their application credentials by using access rules. For example, to create an
application credential that is constricted to creating servers in nova, the
user can add the following access rules:

::

    "access_rules": [
        {
            "path": "/v2.1/servers",
            "method": "POST",
            "service": "compute"
        }
    ]

The ``"path"`` attribute of application credential access rules uses a wildcard
syntax to make it more flexible. For example, to create an application
credential that is constricted to listing server IP addresses, you could use
either of the following access rules:

::

    "access_rules": [
        {
            "path": "/v2.1/servers/*/ips",
            "method": "GET",
            "service": "compute"
        }
    ]

or equivalently:

::

    "access_rules": [
        {
            "path": "/v2.1/servers/{server_id}/ips",
            "method": "GET",
            "service": "compute"
        }
    ]

In both cases, a request path containing any server ID will match the access
rule. For even more flexibility, the recursive wildcard ``**`` indicates that
request paths containing any number of ``/`` will be matched. For example:

::

    "access_rules": [
        {
            "path": "/v2.1/**",
            "method": "GET",
            "service": "compute"
        }
    ]

will match any nova API for version 2.1.

An access rule created for one application credential can be re-used by providing its ID to another application credential, for example:

::

    "access_rules": [
        {
            "id": "abcdef"
        }
    ]

Authenticating with an Application Credential
=============================================

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

To authenticate with an application credential, specify
"application_credential" as the auth method. You are not allowed to request a
scope, as the scope is retrieved from the application credential.

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

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - identity: identity
   - methods: auth_methods_application_credential
   - application_credential: request_application_credential_body_required
   - id: request_application_credential_auth_id_body_not_required
   - name: request_application_credential_auth_name_body_not_required
   - secret: request_application_credential_auth_secret_body_required
   - user: request_application_credential_user_body_not_required

Example
~~~~~~~

An application credential can be identified by an ID:

.. literalinclude:: samples/admin/auth-application-credential-id-request.json
   :language: javascript

It can also be identified by its name and a user object:

.. literalinclude:: samples/admin/auth-application-credential-name-request.json
   :language: javascript

Response
--------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - X-Subject-Token: X-Subject-Token
   - token: token
   - application_credential: auth_application_credential_body
   - application_credential.id: response_application_credential_id_body
   - application_credential.name: response_application_credential_name_body
   - application_credential.restricted: response_application_credential_unrestricted_body
   - audit_ids: audit_ids
   - catalog: catalog
   - expires_at: expires_at
   - issued_at: issued_at
   - methods: auth_methods
   - project: project
   - roles: roles
   - user: user
   - user.id: user_id
   - user.name: user_name

Example
~~~~~~~

.. literalinclude:: samples/admin/auth-application-credential-response.json
   :language: javascript

A token created with an application credential will have the scope and roles
designated by the application credential.

Create application credential
=============================

.. rest_method::  POST /v3/users/{user_id}/application_credentials

Creates an application credential for a user on the project to which the
current token is scoped.

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

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - user_id: request_application_credential_user_id_path_required
   - application_credential: request_application_credential_body_required
   - name: request_application_credential_name_body_required
   - secret: request_application_credential_secret_body_not_required
   - description: request_application_credential_description_body_not_required
   - expires_at: request_application_credential_expires_at_body_not_required
   - roles: request_application_credential_roles_body_not_required
   - unrestricted: request_application_credential_unrestricted_body_not_required
   - access_rules: request_application_credential_access_rules_body_not_required

Example
~~~~~~~

.. literalinclude:: samples/admin/application-credential-create-request.json
   :language: javascript

Response
--------

.. rest_status_code:: success status.yaml

   - 201

.. rest_status_code:: error status.yaml

   - 400
   - 401
   - 403
   - 404
   - 409

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - application_credential: response_application_credential_body
   - id: response_application_credential_id_body
   - name: response_application_credential_name_body
   - secret: response_application_credential_secret_body
   - description: response_application_credential_description_body
   - expires_at: response_application_credential_expires_at_body
   - project_id: response_application_credential_project_id_body
   - roles: response_application_credential_roles_body
   - access_rules: response_application_credential_access_rules_body
   - unrestricted: response_application_credential_unrestricted_body
   - links: link_response_body

Example
~~~~~~~

.. literalinclude:: samples/admin/application-credential-create-response.json
   :language: javascript

List application credentials
=============================

.. rest_method::  GET /v3/users/{user_id}/application_credentials

List all application credentials for a user.

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

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - user_id: request_application_credential_user_id_path_required
   - name: request_application_credential_name_query_not_required

Response
--------

.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 401
   - 403
   - 404

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - application_credential: response_application_credential_body
   - id: response_application_credential_id_body
   - name: response_application_credential_name_body
   - description: response_application_credential_description_body
   - expires_at: response_application_credential_expires_at_body
   - project_id: response_application_credential_project_id_body
   - roles: response_application_credential_roles_body
   - access_rules: response_application_credential_access_rules_body
   - unrestricted: response_application_credential_unrestricted_body
   - links: link_collection

Example
~~~~~~~

.. literalinclude:: samples/admin/application-credential-list-response.json
   :language: javascript

Show application credential details
===================================

.. rest_method::  GET /v3/users/{user_id}/application_credentials/{application_credential_id}

Show details of an application credential.

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

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - user_id: request_application_credential_user_id_path_required
   - application_credential_id: request_application_credential_id_path_required

Response
--------

.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 401
   - 403
   - 404

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - application_credential: response_application_credential_body
   - id: response_application_credential_id_body
   - name: response_application_credential_name_body
   - description: response_application_credential_description_body
   - expires_at: response_application_credential_expires_at_body
   - project_id: response_application_credential_project_id_body
   - roles: response_application_credential_roles_body
   - access_rules: response_application_credential_access_rules_body
   - unrestricted: response_application_credential_unrestricted_body
   - links: link_response_body

Example
~~~~~~~

.. literalinclude:: samples/admin/application-credential-get-response.json
   :language: javascript

Delete application credential
=============================

.. rest_method::  DELETE /v3/users/{user_id}/application_credentials/{application_credential_id}

Delete an application credential.

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

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - user_id: request_application_credential_user_id_path_required
   - application_credential_id: request_application_credential_id_path_required

Response
--------

.. rest_status_code:: success status.yaml

   - 204

.. rest_status_code:: error status.yaml

   - 401
   - 403
   - 404

List access rules
=================

.. rest_method::  GET /v3/users/{user_id}/access_rules

List all access rules for a user.

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

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

    - user_id: request_access_rule_user_id_path_required

Response
--------

.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 401
   - 403
   - 404

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - access_rules: response_access_rules_body
   - id: response_access_rules_id_body
   - path: response_access_rules_path_body
   - method: response_access_rules_method_body
   - service: response_access_rules_service_body
   - links: link_collection

Example
~~~~~~~

.. literalinclude:: samples/admin/access-rules-list-response.json
   :language: javascript

Show access rule details
========================

.. rest_method::  GET /v3/users/{user_id}/access_rules/{access_rule_id}

Show details of an access rule.

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

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - user_id: request_access_rule_user_id_path_required
   - access_rule_id: request_access_rule_id_path_required

Response
--------

.. rest_status_code:: success status.yaml

   - 200

.. rest_status_code:: error status.yaml

   - 401
   - 403
   - 404

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - access_rules: response_access_rules_body
   - id: response_access_rules_id_body
   - path: response_access_rules_path_body
   - method: response_access_rules_method_body
   - service: response_access_rules_service_body
   - links: link_collection

Example
~~~~~~~

.. literalinclude:: samples/admin/access-rule-get-response.json
   :language: javascript

Delete access rule
==================

.. rest_method::  DELETE /v3/users/{user_id}/access_rules/{access_rule_id}

Delete an access rule. An access rule that is still in use by an application
credential cannot be deleted.

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

Request
-------

Parameters
~~~~~~~~~~

.. rest_parameters:: parameters.yaml

   - user_id: request_access_rule_user_id_path_required
   - access_rule_id: request_access_rule_id_path_required

Response
--------

.. rest_status_code:: success status.yaml

   - 204

.. rest_status_code:: error status.yaml

   - 401
   - 403
   - 404