Module: Clearance::Authentication
- Extended by:
- ActiveSupport::Concern
- Included in:
- Controller
- Defined in:
- lib/clearance/authentication.rb
Instance Method Summary collapse
- #authenticate(params) ⇒ Object
- #current_user ⇒ Object
- #current_user=(user) ⇒ Object
-
#handle_unverified_request ⇒ Object
CSRF protection in Rails >= 3.0.4 weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails.
- #sign_in(user) ⇒ Object
- #sign_out ⇒ Object
- #signed_in? ⇒ Boolean
- #signed_out? ⇒ Boolean
Instance Method Details
#authenticate(params) ⇒ Object
17 18 19 20 21 |
# File 'lib/clearance/authentication.rb', line 17 def authenticate(params) Clearance.configuration.user_model.authenticate( params[:session][:email], params[:session][:password] ) end |
#current_user ⇒ Object
23 24 25 |
# File 'lib/clearance/authentication.rb', line 23 def current_user clearance_session.current_user end |
#current_user=(user) ⇒ Object
27 28 29 |
# File 'lib/clearance/authentication.rb', line 27 def current_user=(user) clearance_session.sign_in user end |
#handle_unverified_request ⇒ Object
CSRF protection in Rails >= 3.0.4 weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails
49 50 51 52 |
# File 'lib/clearance/authentication.rb', line 49 def handle_unverified_request super sign_out end |
#sign_in(user) ⇒ Object
31 32 33 |
# File 'lib/clearance/authentication.rb', line 31 def sign_in(user) clearance_session.sign_in user end |
#sign_out ⇒ Object
35 36 37 |
# File 'lib/clearance/authentication.rb', line 35 def sign_out clearance_session.sign_out end |
#signed_in? ⇒ Boolean
39 40 41 |
# File 'lib/clearance/authentication.rb', line 39 def signed_in? clearance_session.signed_in? end |
#signed_out? ⇒ Boolean
43 44 45 |
# File 'lib/clearance/authentication.rb', line 43 def signed_out? !signed_in? end |