Class: AuthingRuby::Authentication::BaseAuthenticationClient

Inherits:
Object
  • Object
show all
Defined in:
lib/authing_ruby/authentication/BaseAuthenticationClient.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BaseAuthenticationClient

Returns a new instance of BaseAuthenticationClient.



6
7
8
# File 'lib/authing_ruby/authentication/BaseAuthenticationClient.rb', line 6

def initialize(options = {})
  @options = options
end

Instance Method Details

#appHostObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/authing_ruby/authentication/BaseAuthenticationClient.rb', line 10

def appHost
  # 最新版本,传入 appHost
  appHost = @options.fetch(:appHost, nil)
  return appHost if appHost != nil
  # TODO: 用 regex 去掉 appHost 最后的斜杠 "/" (如果有的话)
  
  # 兼容协议认证 API 中传入的 domain
  domain = @options.fetch(:domain, nil)
  if domain != nil
    return "https://#{domain}";
  end

  # 最后使用服务器统一域名 host
  host = @options.fetch(:host, 'https://core.authing.cn')
  return host
end