-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scope support and dependencies fixes #15
Conversation
…e is configurable
This is good stuff, thanks. Will dig into it and merge this weekend. |
A +1 for this, I just have finished implementing restify-oauth2 and was looking for scopes support. Awesome :) |
The work in #15 to introduce scopes makes it clear that we need to be more careful differentiating between authorization and authentication. The method previously-known-as "sendUnauthorized" was really meant to be used in situations where there was no *authentication*, so it needs to be renamed. This is a breaking change.
Hi! I spent a decent amount of time on this today!! It turns out this isn't quite the approach I think is best for Restify–OAuth2. Although the general idea was good, I think the API usability suffered. Plus, these commits got all confusing, mixing up test-fixing stuff and changing of clientId/username and so on with the actual scope work. Let me describe what I think would be best, and then one of us can implement it:
The workflow now is more like it is for existing credentials. You set everything up, and Restify–OAuth2 will call the appropriate hooks, resulting in giving you useful information attached to your request. You can then check that information on appropriate routes that need such checks yourself, and use Finally, we'd want to illustrate this via a new example server + integration test. It'd probably be fine to just do a CC version instead of both ROPC and CC versions. In the meantime, I've released 3.0.0 which fixes the tests and renames Sadly I don't have enough time left this weekend to carry out the above plan myself, so feel free to give it a shot. Otherwise we'll have to wait until my next free weekend... |
it is true that this commit got messed up a bit! I agree completly on the new hook About the proposed |
I think that it is not as flexible as an approach which gives the application the correct information, and lets it handle the processing (similar to how authentication is already handled). You can build a generic centralized handler as a simple Restify plugin on top of the information and methods given by Restify–OAuth2, but you cannot be flexible if you are forced to use a generic centralized handler. Besides, I prefer not to keep business logic in my routes, but instead to handle exactly this kind of stuff inside them. I put the business logic in services, and put stuff like authentication and authorization in the routes. |
Ok, it's good to know different options! |
I'm re-opening this pull because I still have something to clarify. You can see that I implemented the 3 functionalities in this branch - now I'm trying to implement the server example - and I'm not clear how the In my opinion, when this workflow is implemented, the In other word, we should have a |
Well, I would think the application code could track the credentials <-> token correspondence itself, but sure, we could have credentials be |
now tracked in #17 |
Hello,
I've added support for an optional
scope
parameter for the token requests and an optional hook calledauthorizeToken
to authorize a token with a scope to access the resource.I've added some Unit tests also about that.
Moreover, I've updated the test system to work with the current coffee-script version (it seems that vows is not maintained anymore....)