28d95bfc66
With the split of the User Guides, there's no need anymore to have orphan and user_only flags, remove them from the user-guide directory. Only files that keep :orphan: are doc/user-guide/source/hot-guide/hot_advanced_topics.rst and hot_existing_templates.rst since these files are not currently included. Change-Id: I1ac0356d69d8668785f8b1947e8b061731aca747
1.8 KiB
1.8 KiB
Authenticate against an Identity endpoint
To authenticate against the Identity v2.0 endpoint, instantiate a keystoneclient.v_20.client.Client object:
from os import environ as env
import keystoneclient.v2_0.client as ksclient
= ksclient.Client(auth_url=env['OS_AUTH_URL'],
keystone =env['OS_USERNAME'],
username=env['OS_PASSWORD'],
password=env['OS_TENANT_NAME'],
tenant_name=env['OS_REGION_NAME']) region_name
After you instantiate a Client
object, you can retrieve
the token by accessing its auth_token
attribute object:
import keystoneclient.v2_0.client as ksclient
= ksclient.Client(...)
keystone print keystone.auth_token
If the OpenStack cloud is configured to use public-key infrastructure (PKI) tokens, the Python script output looks something like this:
MIIQUQYJKoZIhvcNAQcCoIIQQjCCED4CAQExCTAHBgUrDgMCGjCCDqcGCSqGSIb3DQEHAaCCDpgE
gg6UeyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxMy0xMC0yMFQxNjo1NjoyNi
4zNTg2MjUiLCAiZXhwaXJlcyI6ICIyMDEzLTEwLTIxVDE2OjU2OjI2WiIsICJpZCI6ICJwbGFjZWhv
...
R3g14FJ0BxtTPbo6WarZ+sA3PZwdgIDyGNI-0Oqv-8ih4gJC9C6wBCel1dUXJ0Mn7BN-SfuxkooVk6
e090bcKjTWet3CC8IEj7a6LyLRVTdvmKGA5-pgp2mS5fb3G2mIad4Zeeb-zQn9V3Xf9WUGxuiVu1Hn
fhuUpJT-s9mU7+WEC3-8qkcBjEpqVCvMpmM4INI=
Note
This example shows a subset of a PKI token. A complete token is over 5000 characters long.