Class: AuthenticationController

Inherits:
ApplicationController
  • Object
show all
Includes:
Authentication
Defined in:
app/controllers/authentication_controller.rb

Overview

Authentication with form and OAuth

Instance Method Summary collapse

Methods included from Authentication

#create_token_for_user, #deactivate_token, #pop_token, #redirect_authenticated_user

Instance Method Details

#auth_callbackObject

get /auth/:provider/callback



30
31
32
33
34
35
36
# File 'app/controllers/authentication_controller.rb', line 30

def auth_callback
  data = request.env['omniauth.auth']
  user = @foreign_site.authenticate(data, tracking_for_entity)
  create_token_for_user(user) if user.allow_login?

  redirect_to my_path
end

#createObject

post /login



15
16
17
18
19
# File 'app/controllers/authentication_controller.rb', line 15

def create
  @user    = find_user
  @bouncer = UserBouncer.new(@user, tracking_for_entity)
  bounce_or_allow
end

#destroyObject

delete /logout



22
23
24
25
26
27
# File 'app/controllers/authentication_controller.rb', line 22

def destroy
  deactivate_token if current_user

  cleanup_after_destroy
  redirect_to root_path
end

#newObject

get /login



11
12
# File 'app/controllers/authentication_controller.rb', line 11

def new
end