-
-
Notifications
You must be signed in to change notification settings - Fork 472
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
Fixed #86. Carry parameters set in scope checking further along #87
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ module.exports = function(server, options, parse) { | |
|
||
var tid = req.oauth2.transactionID; | ||
req.oauth2.user = req[userProperty]; | ||
req.oauth2.res = ares || {}; | ||
req.oauth2.res = ares || req.oauth2.info || {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this. If you want the authorization response to be equivalent to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess I'm still unclear as to what 'ares' actually is and very confused as to the purpose of 'allow' if an 'ares' without 'allow' still counts as a validated response. But as I said before I don't care about implementation details, I just want a -> b, so I'll be happy to remove this line and make the info about what scope was accepted available in the parse function. Anything else I should change before we call it good? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the In effect, with your modifications, the results supplied by the immediate callback are interpreted based on the If the two noted lines can be changed, I'm happy and will get this merged. Thanks for your efforts, and the discussion. OAuth is, unfortunately, quite hard to grasp and has a lot of stuff the application is ultimately responsible for. I'm just trying to keep this module as un-assuming as possible, and keep those divisions clear. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can remove this line, but if a programmer is parsing the scopes and determining what to ask the user, then when the user responds 'allow', they'll have no way to know what the user was allowing when the application gets to the grant step, which means that anyone who handles scope will need to implement a parse function that passes Unless they're supposed to save the allowed scope during the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I follow entirely, but you're right on the larger perspective: it is up to the application to present a dialog and, upon the user submitting the form, the application needs to parse out what was approved based on however they do form parameters. All of this should be delegated to the application, and handled by the parse function. If stuff is in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If somebody sets something in the fail case, it's because they need it in the decision and or grant case. Generically, it would seem a much more common case to want the data through the whole process (since it's likely in the format you already need to continue your checks) than to disregard it by default and make it a manual step to have it again. What is it that you're using Again, I'm not waiting on us to have a mutual understanding on this to resubmit the pull request (although I am for the other point), but I do want to understand the process. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Probably nothing. That info can be exactly what you want for |
||
|
||
if (req.oauth2.res.allow === undefined) { | ||
if (!req.body[cancelField]) { req.oauth2.res.allow = true; } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unnecessary. Setting it at
txn.info
below should be sufficient. Am I missing something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's accessed immediately in the next middleware before deserialization has happened again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How's that? Any next middleware should not be invoked if the response is immediate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the next connect / express middleware is invoked because when the allow is false then the user is directed to the dialog. There I need to be able to access
req.oauth2.info
so that I can show the user which scopes were requested so that they can choose to accept them or not.Trust me, I've tried it both ways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I get that, and that's what setting info on the transaction accomplishes at L167, which will be available in the next middleware at
req.oauth2.info
. My issue is with L140, which seems unnecessary. There is no need to setinfo
when allow is true, because the response is sent immediately and no further middleware gets invoked.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting it at L167 doesn't make it available to the next middleware because
req.oauth2 !== txn
when the response is deserialized certain keys oftxn
are copied toreq.oauth2
and when it's serialized certain keys ofreq.oauth2
is copied totxn
.I don't think there's any harm in moving the line down into the
allow !== true
condition, but it has to exist.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha on the serialization bit. Just move this line to L158 then. There may be no harm in setting it in both cases, but I also can't think of a good reason for doing it, so therefore it shouldn't be.