Class: AuthenticationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- AuthenticationController
- Includes:
- Authentication
- Defined in:
- app/controllers/authentication_controller.rb
Overview
Authentication with form and OAuth
Instance Method Summary collapse
-
#auth_callback ⇒ Object
get /auth/:provider/callback.
-
#create ⇒ Object
post /login.
-
#destroy ⇒ Object
delete /logout.
-
#new ⇒ Object
get /login.
Methods included from Authentication
#create_token_for_user, #deactivate_token, #pop_token, #redirect_authenticated_user
Instance Method Details
#auth_callback ⇒ Object
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 |
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#new ⇒ Object
get /login
11 12 |
# File 'app/controllers/authentication_controller.rb', line 11 def new end |