Interesting HTTP Q (not related to REST, of course)...
Here's my list of HTTP auth solutions when working w/ common browsers:
LET THE BROW
SER HANDLE IT ALL
I usually use HTTPS + Basic Auth for browser apps and I let the
browser handle this detail for me. IOW, I set up the server to require
auth for the URIs and let things "flow" from there. No special coding
on the browser client at all.
SCRIPTED PRE-AUTH
Occasionally, I'll set up a scripted "pre-auth" on the browser. In
this case, I use a small JS lib to handle the base64 encoding and
prompt the user to provide user/pass locally, encode it and stuff it
into the headers for ajax calls. I do this on every call, tho and that
can get tedious.
BASIC AUTH COOKIE HACK
Finally, (and I'm not really proud of this one....) I sometimes stuff
the Base64-encoded Basic Auth value as a cookie (sheesh!) and set up
the server to peek into t
he cookie space before throwing a 403 upon
receiving an un-auth'ed request. The advantage here is the cookie is
retained across pages.
That's what I do.
mca
http://amundsen.com/blog/http://twitter.com <at> mamund
http://mamund.com/foaf.rdf#me
On Tue, Feb 7, 2012 at 17:30, jason_h_erickson <jason <at> jasonerickson.com> wrote:
I have a web application that has many web services and an AJAX web client as well as some mobile clients. I won't call them RESTful web services, but I'm trying to get them closer.
One problem I have is that I am trying to avoid having any application state on the serve
r. I have that with the exception of having an authenticated session. Nothing is stored in the session except for the user's "Subject" which knows whether or not it is authenticated and who it is authenticated as.
But I want to get all the way to having no session, but that means I have to authenticate with every request. My mobile clients have no trouble doing this. (In fact, they do it already.) However, this seems to be rather tricky from a browser.
If the ENTIRE application was in one web page, then you could just store the credentials in memory. However, if you have to go from one web pag
e to another, it starts to get hairy.
Does anyone on this list have any best practices for avoiding having any session in web applications (Human to Machine) requiring authentication?
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/rest-discuss/
blockquote>
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/rest-discuss/join
(Yahoo! ID required)
<*> To change settings via email:
rest-discuss-digest <at> yahoogroups.com
rest-discuss-fullfeatured <at> yahoogroups.com
<*> To unsubscribe from this group, send an email to:
rest-discuss-unsubscribe <at> yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/