Module: Elastic::SiteSearch::SSO
- Defined in:
- lib/elastic/site-search/sso.rb
Overview
Single sign-on for the Site Search Dashboard.
Constant Summary collapse
- BASE_URL =
'https://swiftype.com/sso'
Class Method Summary collapse
- .token(user_id, timestamp) ⇒ Object
-
.url(user_id) ⇒ Object
Generate a URL that a user can click on to be logged into the Site Search Dashboard.
Class Method Details
.token(user_id, timestamp) ⇒ Object
17 18 19 |
# File 'lib/elastic/site-search/sso.rb', line 17 def self.token(user_id, ) Digest::SHA1.hexdigest("#{user_id}:#{Elastic::SiteSearch.platform_client_secret}:#{timestamp}") end |
.url(user_id) ⇒ Object
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.
11 12 13 14 15 |
# File 'lib/elastic/site-search/sso.rb', line 11 def self.url(user_id) = Time.now.to_i "#{BASE_URL}?user_id=#{user_id}&client_id=#{Elastic::SiteSearch.platform_client_id}×tamp=#{timestamp}&token=#{token(user_id, timestamp)}" end |