Basic authentication with WEBrick?

V

vasudevram

Hi,

We are using WEBrick on port 80 for development of a Rails app. [We may
move to Mongrel or some other option later].

Assume our host is http://my.host.com.

When we go to http://my.host.com, we get our Rails app's first page
shown correctly.
At this page we will have a login form with username and password.

But we also want to have one more level of authentication, before this
form is shown, a Web server authentication, i.e. when a user tries to
access the URL http://my.host.com, a login dialog should be shown
asking for a username and password - not the username and password of
the Rails app, but one that is handled by the WEBrick server - as I
think is possible (not sure) if using Apache as the web server. Is
there a way to do this with WEBrick?

Thanks
Vasudev
http://www.dancingbison.com
 
M

Manfred Stienstra

vasudevram said:
But we also want to have one more level of authentication, before this
form is shown, a Web server authentication, i.e. when a user tries to
access the URL http://my.host.com, a login dialog should be shown
asking for a username and password - not the username and password of
the Rails app, but one that is handled by the WEBrick server - as I
think is possible (not sure) if using Apache as the web server. Is
there a way to do this with WEBrick?

Sure, you can just send http basic or digest authentication headers
from Rails or if you hack around a little bit, WEBrick. I just released
a library for http authentication last week, the digest stuff is still
beta, but you can use the basic authentication.

http://httpauth.rubyforge.org/classes/HTTPAuth/Basic.html

The rubyforge project page is here:

http://rubyforge.org/projects/httpauth/
 
E

Eric Hodel

We are using WEBrick on port 80 for development of a Rails app. [We
may
move to Mongrel or some other option later].

Assume our host is http://my.host.com.

When we go to http://my.host.com, we get our Rails app's first page
shown correctly.
At this page we will have a login form with username and password.

But we also want to have one more level of authentication, before this
form is shown, a Web server authentication, i.e. when a user tries to
access the URL http://my.host.com, a login dialog should be shown
asking for a username and password - not the username and password of
the Rails app, but one that is handled by the WEBrick server - as I
think is possible (not sure) if using Apache as the web server. Is
there a way to do this with WEBrick?

http://microjet.ath.cx/webrickguide/html/HTTP_Authentication.html
 
V

vasudevram

Eric said:
We are using WEBrick on port 80 for development of a Rails app. [We
may
move to Mongrel or some other option later].

Assume our host is http://my.host.com.

When we go to http://my.host.com, we get our Rails app's first page
shown correctly.
At this page we will have a login form with username and password.

But we also want to have one more level of authentication, before this
form is shown, a Web server authentication, i.e. when a user tries to
access the URL http://my.host.com, a login dialog should be shown

http://microjet.ath.cx/webrickguide/html/HTTP_Authentication.html

--
Eric Hodel - (e-mail address removed) - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

Thanks, all. Will check the links given.

Vasudev
http://www.dancingbison.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top