Class: MaitreD::API::SSO

Inherits:
Object
  • Object
show all
Includes:
Sliver::Action
Defined in:
lib/maitre_d/api/sso.rb

Instance Method Summary collapse

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/maitre_d/api/sso.rb', line 14

def call
  hash = listener.single_sign_on params['id']

  hash[:session] ||= {}
  hash[:session].each { |key, value| session[key] = value }

  if environment['action_dispatch.cookies']
    environment['action_dispatch.cookies']['heroku-nav-data'] =
      params['nav-data']
  else
    Rack::Utils.set_cookie_header! response.headers, 'heroku-nav-data',
      :value => params['nav-data']
  end

  response.status    = 302
  response.body      = ["Redirect to #{hash[:uri]}"]
  response.headers ||= {}
  response.headers['Location'] = hash[:uri]
end

#skip?Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
12
# File 'lib/maitre_d/api/sso.rb', line 4

def skip?
  return false if valid_token? && valid_timestamp?

  response.status = 403
  response.body   = ['403 Forbidden']
  response.headers['Content-Length'] = response.body.first.length.to_s

  true
end