Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This method allows the app to figure out what username and password were passed
- # via basic http auth. Because calling #authenticate_or_request_with_http_basic will
- # fail if no password was sent, I had to hack in my own check (taken from the Rails
- # source) to make sure that they tried to auth.
- def get_credentials
- log_it
- # Grabbed from the rails source...if the user sent auth data...
- if ( request.env['HTTP_AUTHORIZATION'] ||
- request.env['X-HTTP_AUTHORIZATION'] ||
- request.env['X_HTTP_AUTHORIZATION'] ||
- request.env['REDIRECT_X_HTTP_AUTHORIZATION']
- ) then
- authenticate_or_request_with_http_basic do |username, password|
- @username = username
- @password = password
- end
- end
- true
- end
Add Comment
Please, Sign In to add comment