Sha256: 4620dabf472eb42abc60e89b958bd72596a6a0fd417f23ee9e62e21035bc8e3a
Contents?: true
Size: 850 Bytes
Versions: 2
Compression:
Stored size: 850 Bytes
Contents
require 'yao' require 'json' require 'time' require 'yao/token' module Yao %i(tenant_name username password timeout).each do |name| Yao.config.param name, nil end module Auth class << self def try_new if Yao.config.tenant_name && Yao.config.username && Yao.config.password && Yao.default_client Yao::Auth.new end end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yao-0.2.11 | lib/yao/auth.rb |
yao-0.2.10 | lib/yao/auth.rb |