-
Notifications
You must be signed in to change notification settings - Fork 3
feat: device authentication #42
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
Conversation
Since it's getting a little bit complicated now, with the package supporting multiple flows, could we add a small markdown file into
|
@mortenpi Added docs to the PR now. |
* refactor, use dex well known conf, use env for client id * Add docs for device flow * Move auth_suffix under states * tests for device auth * Use custom config endpoint
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.
Mostly cosmetic stuff on the text, but also a little bit of bikeshedding on the configuration endpoint.
Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-authored-by: Morten Piibeleht <morten.piibeleht@gmail.com>
challenge::String | ||
response::String | ||
response::Union{String, Dict{String, Any}} |
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.
Feels like it would have been cleaner to bifurcate the state here to a separate RequestLoginDevice
state. Then we wouldn't have to overload the same state and handling method with logic from both flows. But not going to insist a change in this PR.
@@ -330,19 +441,22 @@ token, or to Failure if the polling times out, or there is an unexpected error. | |||
""" | |||
struct ClaimToken <: State | |||
server::String | |||
challenge::String | |||
response::String | |||
auth_suffix::String |
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.
Same here, a separate ClaimDeviceToken
state may have been cleaner.
Implements device auth flow. As far as the state changes and interface is concerned, device auth flow is the same as the current browser challenge flow. The main advantage of device flow is that it avoids race conditions with the regular browser token because it is treated differently in the backend. Device token feature is not currently deployed on juliahub.com so this PR needs to be tested on development instances.
Working of this PR:
Please see the changes in auth-flow.md file.
Authenticating with device tokens:
The interface does not change for the user.
PkgAuthentication.authenticate()
can be called and it will seamlessly decide on what authentication mechanism to use.