-
Notifications
You must be signed in to change notification settings - Fork 28
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
Requirements from oAuth 2.0 code flow #214
Comments
I have found this sequence diagram to facilitate the discussion: https://github.com/owncloud/oauth2/wiki/OAuth-code-Flow-Sequence-Diagram @relu91 is this aligned with how you did the implementation? |
Yes, that is the question. |
Thank you Ege, I modified it a little bit using WoT actors. You can find the modified version here. A comment about the digram: powerful servients could also play the role of oAuthProviders and Identity providers, but I think that the best option for node-wot is to use existing services. Finally, I have not implemented code flow YET, just because I had those doubts presented in the issue body.
My point is that in this particular case, developers might want to start the oAuth flow ahead of time. For example, a simple UI with a login button. I see two solutions to this use case both of the twos require some changes to spec:
About point 1 (in case the token is passed) we also need a way to communicate the fact the token is expired. So this is another use case to have standardized node-wot errors. See #200
I agree, in fact the other flows of auth implemented relays on the asynchrony of WoT interactions. However, in this case, I was afraid to stress too much the concept of asynchronous, since, as shown in the diagram above, the whole application goes out of focus (new tab in the browser) and the user could answer hours later.
Just a note; as I explained w3c/wot-security#165 and eclipse-thingweb/node-wot#201 I don't think the code flow is applicable for IoT/headless device clients. p.s. if the invitation to the weekly calls is still open, I'd be happy to participate and talk about this topic. I have more time now and I committed to working more on WoT. |
Adding support for tokens in InteractionOptions is possible. Check out for instance how the Presentation API and Remote playback API manages user selections/choices by the UA. Of course, id's and tokens can be passed when needed, but if possible, should be done by the implementation, rather than trusting the application script to handle them. So I'd prefer a separate way to set up security and expect the Scripting API work transparently wrt security flows. That would also work better with headless WoT servients. |
From the last scripting and security api call:
I did my best to summarize what we discuss; if anything is missing or is not clear please feel free to comment. |
Thanks for bringing this up, we need to look at the OAuth2 spec in more detail to better understand the situations in which various flows may and may not be useful for IoT devices. I'll put this on the agenda for today's Security call. |
Comments from Security call May 25:
|
A place to capture use cases for OAuth2 flows. These should carefully read the actual OAuth2 specifications. See w3c/wot-scripting-api#214 for discussion.
Let's capture some detailed use cases here: https://github.com/w3c/wot-architecture/blob/master/USE-CASES/oauth.md |
I am commenting to bring this issue up again. Even if OAuth 2.0 is now officially supported by the TD (see w3c/wot-thing-description#927), the original issue is not solved yet. Now that we have defined some concrete use cases for the
I see this as a pretty common use case in WoT scripts. In general, this goes under the category "how to provision security dynamically from scripts". For example, another related use case would be: Hypothesis
Use caseWrite a simple application that asks the user&password and accesses a TD property. Currently, this cannot be done from a WoT Script. In node-wot, we work around this limitation by embedding the servient inside a normal application. I guess we could really improve the developer experience if we also take this use case into consideration. Following the previous statement:
I think that the only way to fulfill the requirements from that use-case is to design an API that demands the servient runtime to ask for user input. Anyhow, let's discuss this after the Note publication. |
Note: I suggest to remove the F2F label and re-label it with use-case and TD |
A related TD issue w3c/wot-thing-description#926 has been closed by now. There is another TD issues which plans to tackle OAuth (see w3c/wot-thing-description#1395) but I don't think this covers our aspect. I am inclined to open a new issue on TD side but would like to ask for your feedback first. More important, what do we expect from the TD. They could simply say: "Yes, for OAuth 2.0 code flow a human in the loop is required" |
While I was working on eclipse-thingweb/node-wot#201 I found that the oAuth2.0 code flow might require some structural changes to Scripts and Scripting API.
In particular, the flow expects that the client should redirect the user using a user-agent to a login/consent page and later obtain the access token with redirection. Consequently, a binding implementation that supports this flow should stop the current script, redirect the user, wait for the answer, and resume. Those operations could happen every time a Property/Action/Event with that security schema is used.
This means that:
A Script may be stopped/put in the background until the user consent giving the access to his resources. Therefore, it might be another use-case for the specification of script management.
A developer might want to trigger the security initialization at will using API so that it can provide a linear UX (i.e. create a login button and do not prompt the user only when it uses some underline property/action/event)
Further, details can be found on the PR page liked above.
The text was updated successfully, but these errors were encountered: