You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/app/strategies/auth_cookie_strategy.rb

19 lines
269 B
Ruby

class AuthCookieStrategy < ::Warden::Strategies::Base
def valid?
auth_token.present?
end
def authenticate!
user = User.for_auth_token(auth_token)
user && success!(user)
end
private
def auth_token
request.cookies['auth_token']
end
end