Basic authentication doesn't support the concept of "logging out" -
see this Apache FAQ:

http://httpd.apache.org/docs/1.3/howto/auth.html#basicfaq

--Matt Jones

On Aug 5, 3:05 pm, Tony Tony <[email protected]> wrote:
> Hi all,
>
> I'm writting a small app that requires basic authentication in Sinatra.
> I followed the advice of the official Sinatra faq
> (http://www.sinatrarb.com/faq.html#auth) and have implemented this code
> with success:
>
> [code]
> require 'rubygems'
> require 'sinatra'
>
> helpers do
>
>   def protected!
>     response['WWW-Authenticate'] = %(Basic realm="Testing HTTP Auth")
> and \
>     throw(:halt, [401, "Not authorized\n"]) and \
>     return unless authorized?
>   end
>
>   def authorized?
>     @auth ||=  Rack::Auth::Basic::Request.new(request.env)
>     @auth.provided? && @auth.basic? && @auth.credentials &&
> @auth.credentials == ['admin', 'admin']
>   end
>
> end
>
> get '/' do
>   "Everybody can see this page"
> end
>
> get '/protected' do
>   protected!
>   "Welcome, authenticated client"
> end
> [/code]
>
> So I get a window asking me to ender my credentials when going to
> /protected and it logs me in. Once logged in though, I would like to be
> able to log out. I know the solution to this must be super easy but I
> just can't get it to work.
>
> Any help is greatly appreciated. Thanks!
>
> -Tony
> --
> Posted viahttp://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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to