Search the web
Sign In
New User? Sign Up
rest-discuss · REST Discussion Mailing List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Pretty URLs, sessions, and no cookies   Message List  
Reply | Forward Message #10909 of 14029 |
Re: Pretty URLs, sessions, and no cookies

* Michael Schuerig <michael@...> [2008-06-11 02:30]:
> Authentication information is usually enough.

Then you don’t need to store anything on the server. There is no
need for a session at all. Either use HTTP Auth or, in case you
are talking to a browser, use a cookie like this:

auth_token = concat( username, ":", expiration_datetime );
msghash = digest_hmac( concat( server_secret, ":", auth_token ) );
cookie = concat( msghash, ":", auth_token );

With this scheme, cookies cannot be forged because generating
a correct message hash requires knowledge of the server secret
that is not part of the cookie. So if the client sends you a
cookie whose hash checks out, you know it’s a cookie you minted
and you can therefore trust the username portion of the cookie.
Aside from the server secret, which is easily kept in memory,
you don’t need any information external to the cookie in order
to verify it: no on-disk session.


* Bruno Harbulot <Bruno.Harbulot@...> [2008-06-11 04:45]:
> I think this doesn't contradict the stateless interactions
> principle of REST, as long as the session is only used for
> authentication purposes.

Indeed it doesn’t.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>



Wed Jun 11, 2008 6:26 am

a22pag
Offline Offline
Send Email Send Email

Forward
Message #10909 of 14029 |
Expand Messages Author Sort by Date

I've come to see pretty URLs as part of a resource-oriented system, although this is not strictly true, of course. That I've been using Ruby on Rails for...
Michael Schuerig
mschuerig
Offline Send Email
Jun 10, 2008
1:53 pm

When I want to track a user throughout multiple requests (session) without using a cookie, I use HTTP Authentication. I will point out that most of the time I...
mike amundsen
mamund
Offline Send Email
Jun 10, 2008
2:09 pm

... I think you should start by questioning whether you need sessions in the first place. What data are you storing in them and why does that data not deserve...
Aristotle Pagaltzis
a22pag
Offline Send Email
Jun 10, 2008
10:16 pm

... When I have a *user* interface where some resources need authenticated access, then I need some kind of session, don't I? Michael -- Michael Schuerig ...
Michael Schuerig
mschuerig
Offline Send Email
Jun 10, 2008
10:33 pm

... Not necessarily. If you want to be purely RESTful, you'd strive to use HTTP authentication for such things, but practically that's tough. Often,...
Josh Sled
joshsled
Offline Send Email
Jun 10, 2008
11:29 pm

... [snip] ... Authentication information is usually enough. Michael -- Michael Schuerig mailto:michael@... http://www.schuerig.de/michael/...
Michael Schuerig
mschuerig
Offline Send Email
Jun 11, 2008
12:26 am

Hello, ... I agree entirely. Although I'd also prefer authentication mechanisms based on WWW-Authenticate (and related headers), sometimes, it's practically...
Bruno Harbulot
bruno_harbulot
Offline Send Email
Jun 11, 2008
2:40 am

... Then you don’t need to store anything on the server. There is no need for a session at all. Either use HTTP Auth or, in case you are talking to a...
Aristotle Pagaltzis
a22pag
Offline Send Email
Jun 11, 2008
6:26 am

... I don't want to use a cookie, that's more or less the whole point of my original message. I know how to get what I want with a cookie, my question is,...
Michael Schuerig
mschuerig
Offline Send Email
Jun 11, 2008
7:36 am

... I'm not sure why you're so against cookies. They usually conflict with the stateless interactions principle, but in this case you have little choice. ... ...
Bruno Harbulot
bruno_harbulot
Offline Send Email
Jun 11, 2008
9:51 am

... Bruno, thanks for your extensive reply. I'm not a fervent opponent of cookies and JavaScript, indeed, I'm happily using both of them. The reason for my...
Michael Schuerig
mschuerig
Offline Send Email
Jun 11, 2008
11:01 am

... Ah, I sort of missed that part. How could you possibly do that? The auth information has to be *some*where – either in the URI, or in headers, or in the...
Aristotle Pagaltzis
a22pag
Offline Send Email
Jun 11, 2008
8:20 pm

... I don't know, that's why I asked. Michael -- Michael Schuerig mailto:michael@... http://www.schuerig.de/michael/...
Michael Schuerig
mschuerig
Offline Send Email
Jun 11, 2008
9:33 pm

... Something similar to this is what Rails does by default since version 2....
Xavier Noria
fxnr
Offline Send Email
Jun 11, 2008
8:50 pm

... I spent quite a lot of time on this issue a few months back, determined to not use cookies. I implemented an http basic auth solutionfor parts of the api,...
Peter Keane
pkeane_littl...
Offline Send Email
Jun 11, 2008
9:16 pm

Michael Schuerig wrote (in ... When you have a user interface in which access to some resources requires authentication (and, presumably, authorization), there...
Etan Wexler
etan_wexler
Offline Send Email
Jun 10, 2008
11:25 pm

... Most respondents have apparently understood "session" as meaning server-side conversational state. That's not what I had in mind, I'm quite content with...
Michael Schuerig
mschuerig
Offline Send Email
Jun 11, 2008
12:58 am

Michael- I've had good luck with a two-step page load: the html page is rendered regardless of identity/authorization and is identical for all users (and is...
Peter Keane
pkeane_littl...
Offline Send Email
Jun 11, 2008
1:21 am

... That's an interesting approach. I wouldn't object to "private" URLs in this case, but there's still the cookie. Michael -- Michael Schuerig ...
Michael Schuerig
mschuerig
Offline Send Email
Jun 11, 2008
7:34 am

Michael: Some comments on the HTTP Auth issue: First, HTTP Auth is your best (safest, easiest, most portable) way to identify your users. This is especially...
mike amundsen
mamund
Offline Send Email
Jun 11, 2008
1:22 am

... Unfortunately, because they are what they are, they are not acceptable. I see your point regarding non-human interaction, but that's a different issue. ......
Michael Schuerig
mschuerig
Offline Send Email
Jun 11, 2008
8:02 am

... As you point out, the only problem with cookies used in a RESTful way (i.e. not identifying server-side conversation state) is that you can't have two...
Stefan Tilkov
stilkov
Offline Send Email
Jun 11, 2008
8:33 am

... Another issue is that some users don't want (allow, trust) cookies. I can't tell how much of a problem this really is, but I know that I get annoyed when I...
Michael Schuerig
mschuerig
Offline Send Email
Jun 11, 2008
8:48 am

... As far as I know, most browsers also effectively perform single-sign on of a single user (for that realm) across tabs and windows with HTTP authentication....
Bruno Harbulot
bruno_harbulot
Offline Send Email
Jun 11, 2008
8:49 am

... Then instead of sending 403 with a login page in the body, send 303 with the non-personalised URI in Location. Don’t forget to Vary on whatever header...
Aristotle Pagaltzis
a22pag
Offline Send Email
Jun 11, 2008
8:27 pm

Michael Schuerig wrote (in ... Identification of resources is fundamental to the Representational State Transfer. I favor promoting representations to...
Etan Wexler
etan_wexler
Offline Send Email
Jun 11, 2008
2:44 am

... I agree when it comes to non-human requesters, for human beings I'm not convinced. ... Agreed, but that is the state of things, and to my mind it is a ...
Michael Schuerig
mschuerig
Offline Send Email
Jun 11, 2008
8:04 am

... It does matter, even for human users: think of it as "bookmarkable" URLs. Have you ever been on a shopping website, looked at a product, found it...
Bruno Harbulot
bruno_harbulot
Offline Send Email
Jun 11, 2008
9:27 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help