lib/yao/auth.rb in yao-0.11.3 vs lib/yao/auth.rb in yao-0.12.0
- old
+ new
@@ -17,10 +17,11 @@
Yao::Auth.new
end
end
def build_authv3_info(tenant_name, username, password,
+ default_domain,
user_domain_id, user_domain_name,
project_domain_id, project_domain_name)
identity = {
methods: ["password"],
password: {
@@ -29,19 +30,23 @@
}
if user_domain_id
identity[:password][:user][:domain] = { id: user_domain_id }
elsif user_domain_name
identity[:password][:user][:domain] = { name: user_domain_name }
+ elsif default_domain
+ identity[:password][:user][:domain] = { id: default_domain }
end
scope = {
project: { name: tenant_name }
}
if project_domain_id
scope[:project][:domain] = { id: project_domain_id }
elsif project_domain_name
scope[:project][:domain] = { name: project_domain_name }
+ elsif default_domain
+ scope[:project][:domain] = { id: default_domain }
end
{
auth: {
identity: identity,
@@ -66,16 +71,18 @@
def new(
tenant_name: Yao.config.tenant_name,
username: Yao.config.username,
password: Yao.config.password,
identity_api_version: Yao.config.identity_api_version,
+ default_domain: Yao.config.default_domain,
user_domain_id: Yao.config.user_domain_id,
user_domain_name: Yao.config.user_domain_name,
project_domain_id: Yao.config.project_domain_id,
project_domain_name: Yao.config.project_domain_name
)
if identity_api_version.to_i == 3
auth_info = build_authv3_info(tenant_name, username, password,
+ default_domain,
user_domain_id, user_domain_name,
project_domain_id, project_domain_name)
issue = TokenV3.issue(Yao.default_client.default, auth_info)
else
auth_info = build_auth_info(tenant_name, username, password)