Module: LobbyBoy::SessionHelper
- Defined in:
- app/helpers/lobby_boy/session_helper.rb
Instance Method Summary collapse
-
#confirm_login! ⇒ Object
Call in host rails controller to confirm that the user was logged in.
- #finish_logout! ⇒ Object
- #finish_reauthentication! ⇒ Object
- #id_token ⇒ Object
- #id_token_expired? ⇒ Boolean
- #logout_at_op!(return_url = nil) ⇒ Object
- #reauthentication? ⇒ Boolean
Instance Method Details
#confirm_login! ⇒ Object
Call in host rails controller to confirm that the user was logged in.
5 6 7 8 9 10 |
# File 'app/helpers/lobby_boy/session_helper.rb', line 5 def confirm_login! if LobbyBoy.configured? session['lobby_boy.id_token'] = env['lobby_boy.id_token'].jwt_token [:oidc_rp_state] = env['lobby_boy.cookie'] end end |
#finish_logout! ⇒ Object
20 21 22 |
# File 'app/helpers/lobby_boy/session_helper.rb', line 20 def finish_logout! redirect_to(lobby_boy_path + 'session/state?state=logout') end |
#finish_reauthentication! ⇒ Object
12 13 14 |
# File 'app/helpers/lobby_boy/session_helper.rb', line 12 def finish_reauthentication! redirect_to(lobby_boy_path + 'session/state') end |
#id_token ⇒ Object
28 29 30 31 |
# File 'app/helpers/lobby_boy/session_helper.rb', line 28 def id_token token = session['lobby_boy.id_token'] ::LobbyBoy::OpenIDConnect::IdToken.new token if token end |
#id_token_expired? ⇒ Boolean
24 25 26 |
# File 'app/helpers/lobby_boy/session_helper.rb', line 24 def id_token_expired? id_token && id_token.expires_in == 0 end |
#logout_at_op!(return_url = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/helpers/lobby_boy/session_helper.rb', line 33 def logout_at_op!(return_url = nil) return false unless LobbyBoy.configured? id_token_hint = id_token && id_token.jwt_token logout_url = LobbyBoy::Util::URI.add_query_params( LobbyBoy.provider.end_session_endpoint, id_token_hint: id_token_hint, post_logout_redirect_uri: return_url) .delete :oidc_rp_state, domain: LobbyBoy.client. if logout_url # may be nil if not configured redirect_to logout_url # log out at OpenIDConnect SSO provider too true else false end end |
#reauthentication? ⇒ Boolean
16 17 18 |
# File 'app/helpers/lobby_boy/session_helper.rb', line 16 def reauthentication? env['omniauth.origin'] == '/session/state' end |