Sha256: 74616e02ba237903475385f55f72aa7ec6635b6a0c283744a6cd959abeae17c8
Contents?: true
Size: 859 Bytes
Versions: 1
Compression:
Stored size: 859 Bytes
Contents
require 'json' require 'time' require 'yao/token' module Yao %i(tenant_name username password timeout client_cert client_key).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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yao-0.3.2 | lib/yao/auth.rb |