Openstack的用户登录流程

openstack的用户登录,需要获得集中权限。

token

只需要提供用户名和密码即可获得,接口

http://public_url/tokens
method:POST
body:{"auth":{"passwordCredentials":{"username":"%s", "password":"%s"}}

所属项目

需要将获得到的用户ID,和所有的租户ID进行逐步的查询,看是否该用户存在于多个项目中。

[root@node-5 newstest-master]# keystone user-role-list --user-id 7bbe7115263f4d33a40c132c03df7091  --tenant-id f7153088a2b34050b4b27a50456a4f3b
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+----------------------------------+--------+----------------------------------+----------------------------------+
|                id                |  name  |             user_id              |            tenant_id             |
+----------------------------------+--------+----------------------------------+----------------------------------+
| 2262da376eb549a6a8ffcde6920c1a67 | Member | 7bbe7115263f4d33a40c132c03df7091 | f7153088a2b34050b4b27a50456a4f3b |
+----------------------------------+--------+----------------------------------+----------------------------------+
[root@node-5 newstest-master]# keystone user-role-list --user-id 7bbe7115263f4d33a40c132c03df7091  --tenant-id ba07f67cfb48445da95f0385b1c8ef1f
WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored).
+----------------------------------+--------+----------------------------------+----------------------------------+
|                id                |  name  |             user_id              |            tenant_id             |
+----------------------------------+--------+----------------------------------+----------------------------------+
| 2262da376eb549a6a8ffcde6920c1a67 | Member | 7bbe7115263f4d33a40c132c03df7091 | ba07f67cfb48445da95f0385b1c8ef1f |
| 975b2c24fa53461f97ef1186e55b6ecf | admin  | 7bbe7115263f4d33a40c132c03df7091 | ba07f67cfb48445da95f0385b1c8ef1f |
+----------------------------------+--------+----------------------------------+----------------------------------+

这里表示相同的用户,在不同的用户中都有存在数据,登录时都需要查询出来。

原文地址:https://www.cnblogs.com/CLTANG/p/4332546.html