Class: ShellManager::IDP

Inherits:
Object
  • Object
show all
Defined in:
lib/smidp.rb

Class Method Summary collapse

Class Method Details

.ssoHandler(apiKey, token) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/smidp.rb', line 4

def self.ssoHandler(apiKey, token)
  if token == "user_denied"
    '{"code":"user_denied"}'
  else
    begin
      res = RestClient.post "https://monarchshells.com/api/v1/federation/handoff", {key: apiKey, token: token}.to_json
    rescue RestClient::ExceptionWithResponse
      '{"code":"error"}'
    end
    if res.body.present?
      res.body
    else
      '{"code":"failure"}'
    end
  end
end

.ssoRedirect(pubKey, retUrl) ⇒ Object


20
21
22
# File 'lib/smidp.rb', line 20

def self.ssoRedirect(pubKey, retUrl)
  "https://monarchshells.com/api/v1/federation/signon?appid=#{pubKey}&redir=#{retUrl}"
end