Module: Yao::Auth

Defined in:
lib/yao/auth.rb

Class Method Summary collapse

Class Method Details

.new(tenant_name: Yao.config.tenant_name, username: Yao.config.username, password: Yao.config.password) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/yao/auth.rb', line 20

def new(
    tenant_name: Yao.config.tenant_name,
    username: Yao.config.username,
    password: Yao.config.password
)
  auth_info = {
    auth: {
      passwordCredentials: {
        username: username, password: password
      }
    }
  }
  auth_info[:auth][:tenantName] = tenant_name if tenant_name

  return Token.issue(Yao.default_client.default, auth_info)
end

.try_newObject



14
15
16
17
18
# File 'lib/yao/auth.rb', line 14

def try_new
  if Yao.config.tenant_name && Yao.config.username && Yao.config.password && Yao.default_client
    Yao::Auth.new
  end
end