Class: DeviseG5Authenticatable::SessionsController

Inherits:
Devise::OmniauthCallbacksController
  • Object
show all
Defined in:
app/controllers/devise_g5_authenticatable/sessions_controller.rb

Overview

Custom sessions controller to require sign-in through the G5 auth server

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
# File 'app/controllers/devise_g5_authenticatable/sessions_controller.rb', line 16

def create
  self.resource = resource_class.find_and_update_for_g5_oauth(auth_data)
  resource ?  : register_resource
end

#destroyObject



21
22
23
24
25
# File 'app/controllers/devise_g5_authenticatable/sessions_controller.rb', line 21

def destroy
  signed_in_resource.try(:revoke_g5_credentials!)
  local_sign_out
  remote_sign_out
end

#newObject



8
9
10
# File 'app/controllers/devise_g5_authenticatable/sessions_controller.rb', line 8

def new
  redirect_to g5_authorize_path(resource_name)
end

#omniauth_passthruObject



12
13
14
# File 'app/controllers/devise_g5_authenticatable/sessions_controller.rb', line 12

def omniauth_passthru
  render status: 404, plain: 'Authentication passthru.'
end