-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
More usage applicable documentation #137
Comments
Hey @sidju, Thanks for this feedback. I've had to spend so much time buried in the specs to write this crate (and Many of the questions you raised (e.g., "Are the claims encrypted, how tamper-proof are they?") are about the OIDC protocol in general, and not specific to this crate's interfaces. Answers to those questions already exist in the specs and various implementation-agnostic resources around the web. I don't think the documentation for every library in every programming language should attempt to fully explain the protocol, just as HTTP client libraries don't attempt to explain HTTP itself to their users. Given that this protocol is for security-critical functionality, I would expect users to learn enough about the protocol to answer basic questions like "is my use case a confidential client that can store a This doesn't mean I think the current docs can't be improved significantly. They could, for example, explicitly list the decisions (e.g., choice of auth flow) users need to make before trying to use the library, along with links to good resources containing the information they'll need to make those decisions. The sorts of hints you listed would also be a nice addition as a reminder to users what certain types are used for. We should be careful not to be overly prescriptive though, since, for example, the CSRF token and nonce could also be stored in a cookie depending on the type of application the user is working on. This is another good opportunity for links to external resources that discuss the various storage options and their tradeoffs. |
Thank you for the quick response. That is a very reasonable limitation of scope and expectation on the users. I'll see if I can make a PR with some additional comments in the examples (mainly which type comes out and why, as that is a bit difficult to parse with all the type arguments the Client takes), maybe some getting started information in the crate documentation, and some extra documentation on the types. Mainly how you are expected to get an instance of a type and which type is the typical implementer of a trait should be documented, as there are so many types implementing so many traits that it is easy to get lost looking for a method in a trait that is implemented on a type. |
That sounds great, thanks! |
The current documentation showcases how to communicate with the Authentication Provider and verify the responses, but it doesn't mention a lot of how to build an authentication flow on it.
I'm very uncertain about these answers (as the best I can find is implications that something similar is done by a different OIDC implementation and no real examples), but I'll at least suggest the questions I've had while trying to implement an authentication with this library:
(the .access_token() is the oauth part of the response that allows the OIDC client to prove the users permission to act in their stead, the .extra_fields().id_token() is the OIDC part of the response with data for the default claims and the claims configured for the OIDC client)
(It seems like JWTs are generally asymmetrically encrypted, but the main relevant documentation would be how tamper proof they are and how the algorithm matters. Also more should be specified about Nonce and why it is required, not only that it is strongly recommended.)
(There seems to be a standard of verifying the Nonce every time, since one often stores the IdToken in locations that aren't tamper proof and wish to verify that it hasn't been replaced by another (still signed and valid) IdToken with different properties. To enable this one should either maintain internal state with the Nonce or save an opaque cookie to the user's browser which after hashing or decryption equals the Nonce. The latter is not secure for client side applications, as they cannot prevent attackers reading out their hashing algorithm or encryption key from the executing code, so they should store the Nonce as is internally instead of making it accessible for modification by others through a cookie.)
That is what I've figure this far, from a lot of research. It would be nice if this information was available on the types it relates to or in the examples. Just some quick hints in the style of:
If you can confirm this is something you want I can make a PR. I've clearly already written half of what I wanted to add.
The text was updated successfully, but these errors were encountered: