Rails 3 HTTP Digest Authentication

Is HTTP Digest Authentication Still Available in Rails 3?

I tried the following code in Rails 2.3.5, it works.

class Admin::BaseController < ApplicationController before_filter :authenticate USERS = { "lifo" => "world" } def authenticate authenticate_or_request_with_http_digest("Application") do |name| USERS[name] end end end 

Now the same thing in Rails 3.0.0.beta returns an error:

 can't convert nil into String 

Am I missing something or is this a bug in Rails 3? Basic HTTP validation works fine.

+4
source share
1 answer

The same problem in Rails beta2.

Quick and dirty fix:

add

 self.config.secret = "result of rake secret" 

before

 authenticate_or_request_with_http_digest("Application") 
+1
source

Source: https://habr.com/ru/post/1306850/


All Articles