I'd like to be able to use the API keys to allow unauthenticated users/applications to create short urls i.e. so the shortening service isn't wide open. I've created a patch that will update the access callback to allow for an API key or an authenticated user with the correct permission.
Thoughts?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 0001-added-api-authentication.patch | 1.63 KB | that0n3guy |
| #8 | restful_api_key_authentication-982268-8.patch | 1.38 KB | beanjammin |
| #6 | shurly_service.module.patch | 1.42 KB | bendodd |
| #1 | shurly_service.module.patch | 1 KB | bendodd |
Comments
Comment #1
bendodd commentedSorry, file didn't upload
Comment #2
jjeff commentedI like this. We should have some sort of option to turn this on/off in the settings though. Think you could add that?
Comment #3
bendodd commentedShould this be per user? If not, then I guess it's a permission as opposed to a setting?
Comment #4
jjeff commentedHmmm... Now I'm starting to get confused.
Remind me of your use case here. You want to allow anonymous users to create URLs through the web interface, but NOT through web services? Won't the throttling options help you out here?
Comment #5
bendodd commentedI want to be able to allow users/applications that have got an API key to create short URLs without having to actually have a current authenticated Drupal session. This allows applications outside Drupal to use this module without having to go down the route of authenticating (via XML-RPC etc). Make sense?
Comment #6
bendodd commentedLike this...
Comment #7
rjbrown99 commented+1, I like this and will be using this in prod.
Comment #8
beanjammin commentedI've re-rolled bendodd's patch from #6 to make it drush makefile compliant.
Comment #9
that0n3guy commentedAttached is #8 rolled against 7.x beta2 (sorry its not against dev...didn't have time).
Comment #10
beanjammin commentedThe patch from #8 applies cleanly to 6.x-1.0.
Comment #11
rjbrown99 commentedI have been using #6 (same as #8) now for many months. I'm marking it RTBC, no issues in prod.
Comment #12
quicksketchHi guys! Thanks for this patch. I made a similar change to fix authentication in shurly before I found this issue:
http://drupalcode.org/project/shurly.git/commitdiff/0df0d2d6276d0af53146...
With that change, it has the same effect as your patch, but doesn't add the additional permission. In my opinion, if the user uses the API key, it should *always* have that user's level of permission. After all what would be the point of giving people API keys if it treated them all as anonymous users? Let me know if you think this patch is still necessary (and the requirement of the new permission). If we *do* decide to add this patch, we'll also need an upgrade path.
Comment #13
jibus commentedMarked as fixed, since it's a old issue. A valid api key is now required to order to generate short urls.