Sha256: d6cab0cbce6e45a1aa732ff45b1ca3ffe239d136ba629a78880221c7a3ae76fb
Contents?: true
Size: 767 Bytes
Versions: 2
Compression:
Stored size: 767 Bytes
Contents
require 'digest/sha1' module Elastic module SiteSearch # Single sign-on for the Site Search Dashboard. module SSO BASE_URL = 'https://swiftype.com/sso' # 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. def self.url(user_id) timestamp = 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 def self.token(user_id, timestamp) Digest::SHA1.hexdigest("#{user_id}:#{Elastic::SiteSearch.platform_client_secret}:#{timestamp}") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
elastic-site-search-2.1.0 | lib/elastic/site-search/sso.rb |
elastic-site-search-2.0.0 | lib/elastic/site-search/sso.rb |