I''m trying to HTTP Basic Authentication mentioned at http://railscasts.com/episodes/82-http-basic-authentication I''m trying to understand the document. http://github.com/rails/rails/blob/be7b64b35aac1c9e9063d1d8317f8b1be2a3411c/actionpack/lib/action_controller/http_authentication.rb#L111 The RailsCasts sample is: def authenticate authenticate_or_request_with_http_basic do |username, password| username == "foo" && password == "bar" end end But I would like to change "realm" as well. It looks possible in the documentation. But I don''t understand how to do it because my understanding of block in Ruby isn''t good. Can anybody give me a sample that uses "realm"? John
Try: authenticate_or_request_with_http_basic(''YourRealm'') do |username, password| username == "foo" && password == "bar" end Dmitry
Thanks. That''s how I can pass the first argument. Now I understand. Thanks. John On Wed, Apr 22, 2009 at 10:49 PM, Dmitry Sokurenko <Dmitry.Sokurenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Try: > > authenticate_or_request_with_http_basic(''YourRealm'') do |username, > password| > username == "foo" && password == "bar" > end > > Dmitry > > >
Does the code..... http_basic_authenticate_with :name=>"foo" :password=>"bar" will this work? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.