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

Add GitLab OAuth flow the UI #1046

Merged
merged 15 commits into from Nov 18, 2021
Merged

Add GitLab OAuth flow the UI #1046

merged 15 commits into from Nov 18, 2021

Conversation

jpellizzari
Copy link
Contributor

@jpellizzari jpellizzari commented Nov 8, 2021

Closes: #985

Adds Gitlab token retrieval to the UI:
https://drive.google.com/file/d/1w4zGgM_V1FCn4khD0Tp5DPzCO4kreEpa/view?usp=sharing

Also adds:

  • API endpoint around Repo URL parsing
  • API endpoints for initiating and completing the token flow
  • A new RepoInputWithAuth component that seeks to encapsulate the auto-detection behavior.

Known limitations:

  • Does not seek to successfully add an Application to GitLab via the UI; completing this work would conflict with the 768 new directory structure #1024 PR that is being worked on
  • Does not detect a Git Provider on the config repo. Specifying conflicting providers will result in an error.
  • Does NOT account for Git Provider in a secret name stored on the cluster(!!!). Mixing and matching providers on the same cluster will result in errors. Again, this wasn't fixed as it would conflict with 768 new directory structure #1024.

@JamWils Could you focus a review on the GitLab auth stuff

@joshri and @simon Could you check out the React stuff?

@jpellizzari jpellizzari force-pushed the 985-gitlab-ui-auth branch 4 times, most recently from 48a89ee to 81a9355 Compare November 9, 2021 22:29
@jpellizzari jpellizzari changed the title 985 gitlab UI auth Add GitLab OAuth flow the UI Nov 9, 2021
@jpellizzari jpellizzari added the area/ui Issues that require front-end work label Nov 9, 2021
@jpellizzari jpellizzari marked this pull request as ready for review November 9, 2021 22:53
Copy link
Contributor

@joshri joshri left a comment

Choose a reason for hiding this comment

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

Obviously this is 🔥 super hot fire 🔥. Nice!

pkg/services/auth/gitlab.go Outdated Show resolved Hide resolved
ui/pages/OAuthCallback.tsx Outdated Show resolved Hide resolved
ui/pages/ApplicationAdd.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@JamWils JamWils left a comment

Choose a reason for hiding this comment

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

Nice and clean code structure. I only reviewed the Go code. LGTM

@jpellizzari jpellizzari force-pushed the 985-gitlab-ui-auth branch 2 times, most recently from a02097a to 643f707 Compare November 15, 2021 18:12
@jpellizzari
Copy link
Contributor Author

Added a new React.Context provider to better encapsulate the Gitlab auth button behavior. That provider will need to be used wherever a <GitlabAuthButton /> is used.

@jpellizzari jpellizzari merged commit 9c3b3f6 into main Nov 18, 2021
@jpellizzari jpellizzari deleted the 985-gitlab-ui-auth branch November 18, 2021 21:46
joshri pushed a commit that referenced this pull request Nov 19, 2021
* Add ParseRepoURL API method

* Add repo parsing to AddApp page

* Add RepoInput component

* Add Gitlab OAuth routes

* Add gitlab OAuth UI elements

* Prevent page content from overflowing

* Add expiration fallback to jwt client

* Add gitlab test for jwt client

* Log middleware token verification errors

* Store callback state before OAuth navigation

* Remove unused variables from server suite test

* Add CallbackState context

* Use new Git-Provider-Token header name

* Fix gitlab error message

* Wrap RepoInput tests in callback context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui Issues that require front-end work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add GitLab auth token retrieval to the UI
3 participants