Module: Xnode::Keystone

Defined in:
lib/xnode/keystone.rb,
lib/xnode/keystone/utils.rb,
lib/xnode/keystone/version.rb

Defined Under Namespace

Modules: V2, V3

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.auth_data(tenant, username, password) ⇒ Object

Set up a Keystone JSON request body for authentication purposes.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/xnode/keystone/utils.rb', line 10

def auth_data(tenant, username, password)
  payload = {
    :auth => {
      :tenantName => tenant,
      :passwordCredentials => {
        :username => username,
        :password => password
      }
    }
  }
end

.auth_data_v3(username, password) ⇒ Object

Set up a Keystone V3 JSON request body for authentication purposes.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/xnode/keystone/utils.rb', line 24

def auth_data_v3(username, password)
  payload = {
    :auth => {
      :identity => {
        :methods =>
          [
            :password
          ],
        :password => {
          :user => {
            :domain => {
              :id => :default
            },
            :name => username,
            :password => password
          }
        }
      }
    }
  }
end