Created
April 15, 2016 21:26
-
-
Save mcka1n/8dda2b0859b7b9e51d685d9ec76346d8 to your computer and use it in GitHub Desktop.
Rails Basic Auth
This file contains 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
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
before_filter :authenticate | |
private | |
def authenticate | |
authenticate_or_request_with_http_basic do |username, password| | |
username == "tu_user" && password == "tu_password" | |
end | |
warden.custom_failure! if performed? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment