module Elastic::SiteSearch::SSO

Single sign-on for the Site Search Dashboard.

Constants

BASE_URL

Public Class Methods

token(user_id, timestamp) click to toggle source
# File lib/elastic/site-search/sso.rb, line 17
def self.token(user_id, timestamp)
  Digest::SHA1.hexdigest("#{user_id}:#{Elastic::SiteSearch.platform_client_secret}:#{timestamp}")
end
url(user_id) click to toggle source

Generate a URL that a user can click on to be logged into the Site Search Dashboard. This requires the platform_client_id and platform_client_secret configuration options be set.

# File lib/elastic/site-search/sso.rb, line 11
def self.url(user_id)
  timestamp = Time.now.to_i

  "#{BASE_URL}?user_id=#{user_id}&client_id=#{Elastic::SiteSearch.platform_client_id}&timestamp=#{timestamp}&token=#{token(user_id, timestamp)}"
end