Created
May 25, 2015 09:19
-
-
Save ouranos/f1711e61989c6c955063 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/strategies/authentication_token_strategy.rb | |
class AuthenticationTokenStrategy < ::Warden::Strategies::Base | |
def valid? | |
authentication_token | |
end | |
def authenticate! | |
user = User.find_by_authentication_token(authentication_token) | |
user.nil? ? fail!('strategies.authentication_token.failed') : success!(user) | |
end | |
private | |
def authentication_token | |
params['authentication_token'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment