Class: Machina::CallbacksController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/machina/callbacks_controller.rb

Overview

Completes the Console auth handshake. Console redirects here with the minted session token; the state nonce issued by authenticate! must be echoed back or the token is rejected (login-CSRF / session fixation). The engine has no ApplicationController; Base is required for cookies.

Instance Method Summary collapse

Instance Method Details

#showObject

rubocop:disable Rails/ApplicationController



9
10
11
12
13
14
15
16
17
# File 'app/controllers/machina/callbacks_controller.rb', line 9

def show
  return reject('missing token') if params[:token].blank?
  return reject('state mismatch') unless valid_state?

  cookies.delete(:machina_state)
  reset_session
  store_session_cookie
  redirect_to safe_return_to
end