Module: Mbsy::SingleSignOn
- Defined in:
- lib/mbsy/util/single_sign_on.rb
Class Method Summary collapse
-
.embed_html(o) ⇒ Object
produce the <img> tag to embed in your page to implement Single-Sign-On :email is required and should be the user’s email.
Class Method Details
.embed_html(o) ⇒ Object
produce the <img> tag to embed in your page to implement Single-Sign-On :email is required and should be the user’s email
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/mbsy/util/single_sign_on.rb', line 6 def self.(o) = { api_key: Mbsy.api_key, token: Mbsy::Company.token['token'], method: :login }.merge(o) raise ArgumentError, "key :email is required" if [:email].blank? raise ArgumentError, ":method must be either :login or :logout" unless %w(login logout).include?( [:method].to_s ) signature = Digest::SHA1.hexdigest( [:api_key] + [:email] ) %Q|<img src="https://#{Mbsy.user_name}.getambassador.com/sso/#{[:method]}/?token=#{[:token]}&email=#{CGI::escape([:email])}&signature=#{signature}" style="border: none; visibility: hidden" alt="" />| end |