Class: LobbyBoy::SessionController

Inherits:
ActionController::Base
  • Object
show all
Includes:
Functions, InstanceMethods
Defined in:
app/controllers/lobby_boy/session_controller.rb

Defined Under Namespace

Modules: Functions, InstanceMethods

Instance Method Summary collapse

Methods included from InstanceMethods

#id_token, #render_check, #set_cache_buster

Methods included from Functions

compact_hash, logged_in?, omniauth_prefix

Instance Method Details

#checkObject



7
8
9
10
11
# File 'app/controllers/lobby_boy/session_controller.rb', line 7

def check
  response.headers['X-Frame-Options'] = 'SAMEORIGIN'

  render_check 'init'
end

#endObject



26
27
28
29
30
# File 'app/controllers/lobby_boy/session_controller.rb', line 26

def end
  cookies.delete :oidc_rp_state, domain: LobbyBoy.client.cookie_domain

  redirect_to LobbyBoy.client.end_session_endpoint
end

#refreshObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/lobby_boy/session_controller.rb', line 32

def refresh
  provider = LobbyBoy.provider.name

  id_token = self.id_token

  id_token_hint = id_token && id_token.jwt_token
  origin = '/session/state'

  params = {
      prompt: 'none',
      origin: origin,
      id_token_hint: id_token_hint
  }

  redirect_to "#{omniauth_prefix}/#{provider}?#{compact_hash(params).to_query}"
end

#stateObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/lobby_boy/session_controller.rb', line 13

def state
  current_state =
    if params[:state] == 'unauthenticated'
      'unauthenticated'
    elsif params[:state] == 'logout'
      'logout'
    else
      self.id_token ? 'authenticated' : 'unauthenticated'
    end

  render_check current_state
end