class EME::SSO

Public Class Methods

verify_insecure_sso_token(token) click to toggle source
# File lib/eme/sso.rb, line 18
def self.verify_insecure_sso_token(token)
  auth_request("/sso/ticket/#{token}/verify?tt=sso_insecure", :post)
end
verify_sso_token(token) click to toggle source
# File lib/eme/sso.rb, line 14
def self.verify_sso_token(token)
  auth_request("/sso/ticket/#{token}/verify", :post)
end
verify_tera_token(token) click to toggle source

auth.service.edge.enmasse.com:4567/verify_shop_token/#{token}

# File lib/eme/sso.rb, line 9
def self.verify_tera_token(token)
  return nil if token == nil
  auth_request("/verify_shop_token/#{token}")
end

Private Class Methods

auth_request(path, http_method = :get, data = nil) click to toggle source
# File lib/eme/sso.rb, line 23
def self.auth_request(path, http_method = :get, data = nil)
  auth_response = nil
  Net::HTTP.start(EME::SSO.settings[:auth_server], EME::SSO.settings[:auth_server_port]) do |http|
    http.open_timeout = 5
    http.read_timeout = 10
    auth_response = if http_method == :get
      http.get(path)
    elsif http_method == :post
      http.post(path, data)
    else
      raise RuntimeError, "Only :get and :post are allowed."
    end
  end
  # parse the JSON....
  return JSON.parse auth_response.body
end