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

OAuth fails when browser/charm/gitlab are on different hosts #26

Closed
pedroleaoc opened this issue Jan 18, 2022 · 2 comments
Closed

OAuth fails when browser/charm/gitlab are on different hosts #26

pedroleaoc opened this issue Jan 18, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@pedroleaoc
Copy link
Contributor

pedroleaoc commented Jan 18, 2022

The Legend bundle and the GitLab instance need to be in the same computer or the authentication process fails. This means gitlab.com and EKS deployments will always fail.

@pedroleaoc pedroleaoc changed the title OAuth when browser/charm/gitlab are on different hosts OAuth fails when browser/charm/gitlab are on different hosts Jan 18, 2022
@pedroleaoc pedroleaoc added the bug Something isn't working label Jan 18, 2022
@pedroleaoc pedroleaoc added this to the 2. Charmed Legend on EKS milestone Jan 18, 2022
This was referenced Jan 18, 2022
@claudiubelu
Copy link
Collaborator

When configuring the Legend Juju GitLab Integrator Charm, we have the option to provide it an already existing gitlab.com Application by providing it the bypass-client-id and bypass-client-secret config options.

Howver, when trying to start using the Legend Studio, you will be redirected to gitlab.com to log in and authorize the Legend Studio application, and after that, you're redirected to the original Legend Studio you were trying to access. Basically, the gitlab.com URL used looks something like this:

https://gitlab.com/oauth/authorize?client_id=some_client_id&redirect_uri=http%3A%2F%2F127.0.0.1%3A8080%2Fstudio%2Flog.in%2Fcallback%3Fclient_name%3Dgitlab&response_type=code&scope=openid+profile+api&state=some_state

As you can see in the URL above, there's a redirect_uri, which is basically the original Legend Studio URL you were trying to access.

Now, how the gitlab.com Application authorization works: in the gitlab.com Application, you have configured a list of Redirect URIs, which is used to ensure that no other invalid / unauthorized URL can be used for this gitlab.com Application authentication. The Redirect URLs could looks something like this:

http://10.1.243.217:6060/api/callback
http://10.1.243.214:7070/api/auth/callback
http://10.1.243.214:7070/api/pac4j/login/callback
http://10.1.243.209:8080/studio/log.in/callback

In the case above, the IPs are local to the Kubernetes cluster, which means that we can't use the Legend Studio's Public IP to authenticate it in gitlab.com, since it isn't in the list of the redirect URL mentioned above. The list above would have to be modified to include the Legend Studio Public IP endpoint, but it's also possible for that Public IP to change in the future, In that case, the Redirect URLs should be updated as well.

Ideally, those Redirect URLs would get updated automatically by the Legend Juju GitLab Integrator Charm, but another issue prevents us from doing so (#25).

@claudiubelu
Copy link
Collaborator

We've solved this issue by using the nginx ingress integrator charms and using the Kubernetes Service names instead of IPs. Additionally, the Legend Studio, SDLC, and Engine charms can be configured with custom DNS names as well. With the changes below, we won't have to update the Callback URLs every time the Pod IPs get updated due to various reasons.

Related:

finos/legend-juju-libs#5
finos/legend-juju-libs#8
finos/legend-juju-libs#9
finos/legend-juju-studio-operator#7
finos/legend-juju-sdlc-server-operator#9
finos/legend-juju-engine-server-operator#8
finos/legend-juju-engine-server-operator#9
finos/legend-juju-sdlc-server-operator#10

We can close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants