Needs work
Project:
Token authentication
Version:
6.x-1.6
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Dec 2010 at 15:42 UTC
Updated:
18 Oct 2013 at 20:08 UTC
The attached patch creates a variable (tokenauth_force) that will always append the token to URLs if set, regardless of whether or not the token is in the session or URL.
| Comment | File | Size | Author |
|---|---|---|---|
| tokenauth_force.patch | 2.47 KB | karschsp |
Comments
Comment #1
Grayside commentedComment #2
Grayside commentedWhat is the use case for this functionality?
Comment #3
karschsp commentedI have a site that is all authenticated users and we use Views to generate RSS feeds of their content. If they plug the URL of the RSS feed into a feed reader, they won't get any content because they are not logged in. This setting adds the token to URL of all their RSS feeds, regardless of whether they are viewing a token-auth'd page or not. So, they go to http://example.com log in, and their RSS feed URLs are http://example.com/feed/mine?token=asfasfasf
Comment #4
Grayside commentedOkay, I have thought about this some, and while I'm not sure that a checkbox to activate this mode is the best solution, it makes sense to use. In fact, if you are using tokenauth just for RSS feeds on otherwise closed sites, it makes perfect sense.
I have a few issues with the patch.
Tokenauth Force Description
Spelling errors & use of an escaped quotation in a t() function. Go more like this: 'Append token to all tokenauth-accessible URLs, even if not explicitly set.'
tokenauth_force variable
Should always be TRUE or FALSE and checked as such.
tokenauth_url_outbound_alter
Missing Piece
You need to implement hook_url_inbound_alter() so incoming links are corrected.
Comment #5
gogowitsch commentedHere's an alternative solution: instead of modifying all rendered links, you could give the user a cookie to establish a permanent session instead of a one-off page view. Here's how: Create a new page, set the Input format to PHP code and use code similar to the following:
Let's assume you saved the page and it turns out to be node/5. Then you can send your user to http://example.com/node/5?token=abcdef.
The code will check the token and send the user to /node/4 if he or she was logged in successfully. From that point on, the user is fully logged in and can go to all protected pages.
Comment #6
Grayside commentedThis module is about using a querystring element to drive authentication. It has use cases that preclude the use of user sessions or cookies. It would also be a wider security risk to lean on tokenauth as a legitimate persisting login mechanism.
The plan I've outlined seems fairly reasonable to me and is a direction I would commit if someone felt driven to pursue it. Do you see a problem?