Repository navigation
mobile sso login flow #51
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
Open
brad-defined
wants to merge
1
commit into
main
Choose a base branch
from
sso-login-updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -269,6 +269,58 @@ type EndpointAuthPollData struct { | |
| EnrollmentCode string `json:"enrollmentCode"` | ||
| } | ||
|
|
||
| // PreAuthEndpointV2 begins the v2 (token flow) endpoint auth. Unlike v1, a completed auth yields an | ||
| // endpoint OIDC user auth token rather than an enrollment code. | ||
| const PreAuthEndpointV2 = "/v2/endpoint-auth/preauth" | ||
|
|
||
| // AuthPollEndpointV2 is polled during the v2 flow. On completion it returns an AuthToken. | ||
| const AuthPollEndpointV2 = "/v2/endpoint-auth/poll" | ||
|
|
||
| // EndpointAuthPollDataV2 is returned by AuthPollEndpointV2. | ||
| type EndpointAuthPollDataV2 struct { | ||
| Status EndpointAuthState `json:"state"` | ||
| // AuthToken is set once Status is COMPLETED. It is an endpoint OIDC user auth token used to | ||
| // authenticate the host-management endpoints below. | ||
| AuthToken string `json:"authToken"` | ||
| } | ||
|
|
||
| // EndpointAuthHostsEndpoint lists the hosts owned by the authenticated endpoint OIDC user, and | ||
| // (via POST) creates a new host. Requires an endpoint OIDC user auth token. | ||
| const EndpointAuthHostsEndpoint = "/v2/endpoint-auth/hosts" | ||
|
|
||
| // EndpointAuthHost summarizes a host owned by the authenticated endpoint OIDC user. | ||
| type EndpointAuthHost struct { | ||
| ID string `json:"id"` | ||
| Name string `json:"name"` | ||
| NetworkID string `json:"networkID"` | ||
| IsBlocked bool `json:"isBlocked"` | ||
|
Contributor
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. What should a client do with a blocked host here: skip it when choosing one to renew, or renew it and expect the server to refuse? A line in the doc comment would keep the clients consistent. |
||
| NetworkAccessUntil *time.Time `json:"networkAccessUntil"` | ||
| CreatedAt time.Time `json:"createdAt"` | ||
| } | ||
|
|
||
| // EndpointAuthHostsData is returned by a GET to EndpointAuthHostsEndpoint. | ||
| type EndpointAuthHostsData struct { | ||
| Hosts []EndpointAuthHost `json:"hosts"` | ||
| } | ||
|
|
||
| // EndpointAuthEnrollData is returned when creating a host. The client redeems EnrollmentCode via | ||
| // EnrollEndpoint to bring the newly-created host online. Do NOT send the endpoint OIDC user auth | ||
| // token on the enroll call — EnrollEndpoint rejects requests carrying one. | ||
| type EndpointAuthEnrollData struct { | ||
| HostID string `json:"hostID"` | ||
| EnrollmentCode string `json:"enrollmentCode"` | ||
| } | ||
|
|
||
| // EndpointAuthRenewData is returned when renewing a host. The host has been granted a fresh | ||
| // network-access window and queued for update; it fetches its renewed certificate and config | ||
| // through its own (host-key-signed) update flow, so no enrollment code is issued — the server | ||
| // never overwrites the host's key. NetworkAccessUntil is nil when the provider imposes no | ||
| // session expiry. | ||
| type EndpointAuthRenewData struct { | ||
| HostID string `json:"hostID"` | ||
| NetworkAccessUntil *time.Time `json:"networkAccessUntil"` | ||
| } | ||
|
|
||
| const DownloadsEndpoint = "/v1/downloads" | ||
|
|
||
| type DownloadsData struct { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ignores the request, so nothing checks what makes the v2 calls different from v1: the
Authorization: Bearerheader, the method (GET list vs POST create share a path), and which host ID the renew path carries. Could the queued entry record the method, path, and Authorization header it expects, and fail on a mismatch? That would also let a test assert that Enroll after CreateEndpointHost sends no token.