Skip to content
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

runtime-local auth support #4843

Merged
merged 5 commits into from
May 9, 2024
Merged

runtime-local auth support #4843

merged 5 commits into from
May 9, 2024

Conversation

pjain1
Copy link
Member

@pjain1 pjain1 commented May 6, 2024

  • Support login using PKCE auth flow https://www.oauth.com/oauth2-servers/pkce/ without need for any secrets at local runtime
  • After login access token is persisted locally in ~/.rill/credentials.yaml
  • Next up will be to use this token to deploy project using local UI

@pjain1 pjain1 marked this pull request as draft May 6, 2024 22:29
@pjain1 pjain1 requested a review from begelundmuller May 6, 2024 22:29
Copy link
Contributor

@begelundmuller begelundmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks very good!

admin/database/database.go Outdated Show resolved Hide resolved
admin/server/auth/handlers.go Outdated Show resolved Hide resolved
admin/server/auth/handlers.go Outdated Show resolved Hide resolved
admin/server/auth/pkce.go Outdated Show resolved Hide resolved
admin/server/auth/pkce.go Outdated Show resolved Hide resolved
admin/server/auth/pkce.go Outdated Show resolved Hide resolved
cli/pkg/auth/utils.go Outdated Show resolved Hide resolved
http.Error(w, "failed to exchange code for token", http.StatusInternalServerError)
return
}
// save token and redirect to home screen or TODO url provided in initial request i.e. initiateAuthFlow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it would be nice if we could support a redirect parameter in initiateAuthFlow like we do in the admin auth endpoints.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relying on front end to send origin as query param, if present then redirect back to this url otherwise /

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call the parameter redirect=https://... instead of origin? Just to align naming with the admin's /auth/login endpoint:

redirect := r.URL.Query().Get("redirect")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I can change the query param but in the Authenticator it needs to be called this as there is already a redirectURL field for auth flow

cli/pkg/local/app.go Show resolved Hide resolved
cli/pkg/pkce/authenticator.go Outdated Show resolved Hide resolved
@pjain1 pjain1 requested a review from begelundmuller May 7, 2024 18:38
admin/database/database.go Outdated Show resolved Hide resolved
admin/database/database.go Outdated Show resolved Hide resolved
admin/database/postgres/migrations/0028.sql Outdated Show resolved Hide resolved
admin/server/auth/handlers.go Outdated Show resolved Hide resolved
@pjain1 pjain1 requested a review from begelundmuller May 8, 2024 15:56
@pjain1 pjain1 marked this pull request as ready for review May 9, 2024 09:35
@begelundmuller begelundmuller merged commit 38796b4 into main May 9, 2024
4 checks passed
@begelundmuller begelundmuller deleted the local_auth_flow branch May 9, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants