Class: Devise::Strategies::HttpHeaderAuthenticatable
- Inherits:
-
Base
- Object
- Base
- Devise::Strategies::HttpHeaderAuthenticatable
- Defined in:
- lib/devise/strategies/http_header_authenticatable.rb
Instance Method Summary collapse
- #authenticate! ⇒ Object
-
#valid? ⇒ Boolean
Called if the user doesn’t already have a rails session cookie.
Methods included from DeviseRemote::HttpHeaderAuthenticatableBehavior
Instance Method Details
#authenticate! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/devise/strategies/http_header_authenticatable.rb', line 14 def authenticate! user = remote_user(request.headers) if user.present? u = User.find_by(login: user) if u.nil? u = User.create(login: user, email: user) u.populate_attributes if u.respond_to?(:populate_attributes) end success!(u) else fail! end end |
#valid? ⇒ Boolean
Called if the user doesn’t already have a rails session cookie
10 11 12 |
# File 'lib/devise/strategies/http_header_authenticatable.rb', line 10 def valid? valid_user?(request.headers) end |