Adds documentation on creating Oslo RequestContext in Castellan
This patch adds documentation showing how oslo.context
Request Context can be generated using keystone client. This
documentation will be useful to new Castellan users who are
no familiar with using context.
Change-Id: I60999890cd033808713595087074085bfa915181
“Fernando
8 years ago
24 | 24 | usually populated in the WSGI pipeline. The information contained in this |
25 | 25 | object will be used by Castellan to interact with the specific key manager |
26 | 26 | that is being abstracted. |
27 | ||
28 | **Example. Creating RequestContext from Keystone Client** | |
29 | ||
30 | .. code:: python | |
31 | ||
32 | from keystoneclient.v3 import client | |
33 | from oslo_context import context | |
34 | ||
35 | username = 'admin' | |
36 | password = 'openstack' | |
37 | project_name = 'admin' | |
38 | auth_url = 'http://localhost:5000/v3' | |
39 | keystone_client = client.Client(username=username, | |
40 | password=password, | |
41 | project_name=project_name, | |
42 | auth_url=auth_url, | |
43 | project_domain_id='default') | |
44 | ||
45 | project_list = keystone_client.projects.list(name=project_name) | |
46 | ||
47 | ctxt = context.RequestContext(auth_token=keystone_client.auth_token, | |
48 | tenant=project_list[0].id) | |
49 | ||
50 | ctxt can then be passed into any key_manager api call which requires | |
51 | a RequestContext object. | |
27 | 52 | |
28 | 53 | **Example. Creating and storing a key.** |
29 | 54 |