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 auth token retrieval to the UI #985

Closed
jpellizzari opened this issue Oct 28, 2021 · 2 comments · Fixed by #1046
Closed

Add GitLab auth token retrieval to the UI #985

jpellizzari opened this issue Oct 28, 2021 · 2 comments · Fixed by #1046
Assignees
Labels
area/ui Issues that require front-end work type/story

Comments

@jpellizzari
Copy link
Contributor

jpellizzari commented Oct 28, 2021

According to the ADR, the Gitlab auth flow for the frontend code/experience will need to go something like this: Note that this differs from the current GitHub auth strategy. It is still OAuth, but GitLab is a bit more involved.

  1. Detect the provider from a URL that the user types in
  2. (if Gitlab) Present the user with a button that will take them to the Gitlab OAuth page
  3. After authorizing, Gitlab will send the user back to our callback page (JS or Go HTTP handler?)
  4. A backend route will exchange the challenge code on the backend and covert it into a JWT that gets returned to the UI

Acceptance Criteria:

  • A user should be able to complete the GitLab auth flow during adding/removing an app and listing commits
  • Unit test coverage with sad path cases handled
  • The GitLab UI auth flow should be re-usable by Enterprise (just like the GitHub one is today)
@jpellizzari jpellizzari added area/ui Issues that require front-end work type/story labels Oct 28, 2021
@jpellizzari jpellizzari self-assigned this Nov 2, 2021
@jpellizzari jpellizzari reopened this Nov 19, 2021
@josecordaz
Copy link
Contributor

josecordaz commented Nov 24, 2021

Testing in Chrome and Firefox.

We were able to see the JWT token in both browsers properly.

We noticed some messages referring to Github on Gitlab repos. We saw this message in the UI when trying to authenticate using the button on the commits section. Not sure if this should be expected in this PR.

image.png

And also seen this message after clicking on Remove App button
image.png

@jpellizzari Would you mind helping us to clarify if this is the expected behavior. If not no worries, we can to create some tickets to address these.

@palemtnrider
Copy link
Contributor

While testing with the UI running from within the cluster, we are seeing an expired token error which prohibits adding an app.

@jpellizzari suspects we are requesting a token with an invalid expiration value.

CC @josecordaz

Log message from the container:

2021-11-29T23:07:22.344Z        INFO    middleware/middleware.go:93     invalid token format
[]
2021-11-29T23:07:23.445Z        INFO    middleware/middleware.go:93     invalid token format
2021-11-29T23:07:23.775Z        INFO    middleware/middleware.go:93     invalid token format
[]
2021-11-29T23:07:27.398Z        INFO    middleware/middleware.go:105    could not parse claims: token is expired by 4s: unauthorized token
2021-11-29T23:07:27.399Z        ERROR   middleware/middleware.go:40     server error    {"error": "rpc error: code = Unauthenticated desc = token error: could not get token from context"}
github.com/weaveworks/weave-gitops/pkg/server/middleware.WithGrpcErrorLogging.func1
        /app/pkg/server/middleware/middleware.go:40
github.com/grpc-ecosystem/grpc-gateway/v2/runtime.HTTPError
        /go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@v2.5.0/runtime/errors.go:81
github.com/weaveworks/weave-gitops/pkg/api/applications.RegisterApplicationsHandlerServer.func11
        /app/pkg/api/applications/applications.pb.gw.go:959
github.com/grpc-ecosystem/grpc-gateway/v2/runtime.(*ServeMux).ServeHTTP
        /go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@v2.5.0/runtime/mux.go:251
github.com/weaveworks/weave-gitops/pkg/server/middleware.WithLogging.func1
        /app/pkg/server/middleware/middleware.go:54
net/http.HandlerFunc.ServeHTTP
        /usr/local/go/src/net/http/server.go:2049
github.com/weaveworks/weave-gitops/pkg/server/middleware.WithProviderToken.func1
        /app/pkg/server/middleware/middleware.go:109
net/http.HandlerFunc.ServeHTTP
        /usr/local/go/src/net/http/server.go:2049
net/http.(*ServeMux).ServeHTTP
        /usr/local/go/src/net/http/server.go:2428
net/http.serverHandler.ServeHTTP
        /usr/local/go/src/net/http/server.go:2867
net/http.(*conn).serve
        /usr/local/go/src/net/http/server.go:1932

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 type/story
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants