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

Unable To Link Enterprise Github With Apicurio #1345

Closed
Surbhi27946 opened this issue Dec 8, 2020 · 21 comments
Closed

Unable To Link Enterprise Github With Apicurio #1345

Surbhi27946 opened this issue Dec 8, 2020 · 21 comments
Labels

Comments

@Surbhi27946
Copy link

Hi,
I followed : https://www.apicur.io/studio/docs/setting-up-keycloak-for-use-with-apicurio in order to have our Github as an identity provider with APicurio running locally in our system.

We can see the login option with github is there :
Screenshot 2020-12-08 at 10 53 33 AM

But on clicking the Github login option, We are getting redirected here :
Screenshot 2020-12-08 at 10 55 14 AM

Can you please help on what might have gone wrong?

@Surbhi27946
Copy link
Author

This is the oauth application that I registered in our github :
Uploading Screenshot 2020-12-08 at 10.57.50 AM.png…

@Surbhi27946
Copy link
Author

Also, this github is internal of our organisation : https://gecgithub01.walmart.com/
But on logging in, I am getting directed to my personal github page.

@EricWittmann
Copy link
Member

The screenshot for the OAuth application didn't come through. I can't tell from the 404 github page what might be wrong. However, Keycloak has some additional documentation on this here:

https://www.keycloak.org/docs/latest/server_admin/index.html#github

Have a look at that and see if it helps. Without more information (e.g. screenshots of the actual configuration params in Keycloak and Github) I can't be of more help. :(

@Surbhi27946
Copy link
Author

Surbhi27946 commented Dec 8, 2020

Sorry for that.
Here is the screenshot for the application that we created in our gecgithub :

Screenshot 2020-12-08 at 10 57 50 AM

And the keycloak configuration for the identity provider is:
Screenshot 2020-12-08 at 7 19 31 PM

Is it possible that it is happening because I am configuring github as identity provider on keycloak, whereas the client and the secrets belong to the oauth application created on gecgithub which is internal to Walmart?

@EricWittmann
Copy link
Member

Ah ha! I didn't put that together initially. You are trying to integrate with an instance of GitHub Enterprise, not with github.com. I thought you were referring to a private organization on github.com. My mistake.

So yeah - you will need some different configuration. Instead of configuring a github.com identity provider in Keycloak, you will need to configure a OpenID Connect v1.0 identity provider instead. The good news is that I'm confident this is possible to do without much trouble. The bad news is that I don't have this specific use-case documented, because I don't have access to a GitHub Enterprise installation that I can use to test and verify the configuration steps.

We do have documentation on how to configure a local GitLab server, which is exactly what you want to do but with GitHub Enterprise instead of GitLab CE. Here is the GitLab article for reference:

https://www.apicur.io/studio/docs/using-a-local-installation-of-gitlab

You could try to adapt the information in that article for your situation.

To make this even more complicated (I hope I'm not scaring you away), there is an issue with using the Keycloak OpenID Connect identity provider type with GitHub Enterprise. The problem is discussed here: #831

We have a solution to that problem in the form of a custom Keycloak extension that provides a configurable version of the standard GitHub Keycloak social connector. You can find that extension (with Readme documentation) here:

https://github.com/Apicurio/apicurio-keycloak-extensions

Ignore the GitLab section of the readme and focus on the GitHub section. 👍

@Surbhi27946
Copy link
Author

@EricWittmann
I went through the documentation you provided : https://www.apicur.io/studio/docs/using-a-local-installation-of-gitlab

Sorry but I have few basic questions :

  1. I am using the quickstart to set up the Apicurio locally in my system.
    So where exactly these environment need to be set ?
    APICURIO_GITLAB_API_URL="https://gitlab.example.com"
    export APICURIO_GITLAB_API_URL
  2. What exactly is the environment variable that I should set - APICURIO_GITHUB_API_URL ?

@EricWittmann
Copy link
Member

EricWittmann commented Dec 8, 2020

For GitHub there are two environment variables you must set (or you can use system properties). These are:

https://github.com/Apicurio/apicurio-studio/blob/master/back-end/hub-core/src/main/java/io/apicurio/hub/core/config/HubConfiguration.java#L46-L50
image

You can either use the environment variable approach or the system property approach. If using env vars, something like this:

export APICURIO_GITHUB_URL=https://mygithub.example.com
export APICURIO_GITHUB_API_URL=https://api.mygithub.example.com
$STUDIO_HOME/bin/standalone.sh -b 0.0.0.0 -c standalone-apicurio.xml

If you want to use system properties you can either add them to the right place in the standalone-apicurio.xml file found in the quickstart (in standalone/configuration) or you can add them to the command line:

$STUDIO_HOME/bin/standalone.sh \
    -Dapicurio.hub.github.url=https://mygithub.example.com \
    -Dapicurio.hub.github.api=https://api.mygithub.example.com \
    -b 0.0.0.0 -c standalone-apicurio.xml

@EricWittmann
Copy link
Member

I realize you're just trying to get this working (step 1) but I wanted to mention that it's not recommended to use the Quickstart in production. That's intended to be an evaluation deployment (get started fast). If your plan is to run something in production, I would strongly suggest doing so using the docker images (either via docker compose, kubernetes, or OpenShift).

@Surbhi27946
Copy link
Author

Okay. Thanks a lot @EricWittmann
Will try this up.

@Surbhi27946
Copy link
Author

@EricWittmann
I tried the steps you suggested. I even cloned and build the https://github.com/Apicurio/apicurio-keycloak-extensions and then put the jar in the keycloak standalone/deployments directory as given in the Readme.

And then i am using this command to start my local keycloak instance :
./bin/standalone.sh -Dapicurio.hub.github.baseUrl=https://gecgithub01.walmart.com -Dapicurio.hub.github.apiUrl=https://gecgithub01.walmart.com/api/v3

But still the GitHub Enterprise is not getting listed in the Identity providers dropdown.
Screenshot 2020-12-09 at 4 12 37 PM

@Surbhi27946
Copy link
Author

Do I need to take some other action as well?

@EricWittmann
Copy link
Member

What version of Keycloak are you using? I'll try to reproduce.

@EricWittmann
Copy link
Member

Note: it's possible that you don't have GitHub in that list because you already have a GitHub social connector created. Maybe try deleting that one and seeing if the dropdown changes? I think this because I don't see either "GitHub" entry in the list. And they both have the same built-in value for "provider id" of github.

@Surbhi27946
Copy link
Author

@EricWittmann
Indeed the issue got resolved after deleting the github identity provider.
Now I can see the Github enterprise entry in the drop down.
Thanks a lot for you your help and support.

@EricWittmann
Copy link
Member

OK great! It sounds like you have things going OK. I'm going to close this for now but please feel free to re-open it if you need additional support.

Also if you get everything working the way you want, please consider contributing documentation for how to configure Studio with GitHub Enterprise. It would be very appreciated! :)

@Surbhi27946
Copy link
Author

Surely I would be glad to contribute in the documentation for github enterprise as we have things working as expected.
Let me know the space where can I start documenting or the procedure for it.
Thanks

@EricWittmann
Copy link
Member

That would be amazing, thanks! The Studio documentation is located here:

https://github.com/Apicurio/apicurio.github.io/tree/master/_pages/studio/docs

I would suggest making a copy of using-a-local-installation-of-gitlab.md and using it as a template for a GitHub specific version of it. :)

@Surbhi27946
Copy link
Author

@EricWittmann
I have created the documentation.
Let me know how can I push it into the source code or how can i raise the PR for it.
Thanks

@Surbhi27946 Surbhi27946 changed the title Unable To Link Github With Apicurio Unable To Link Enterprise Github With Apicurio Dec 17, 2020
@EricWittmann
Copy link
Member

That's great! If you wanted to fork that repository and then submit a PR that would be great. If you want to attach the file to this issue or email it to me, that's fine too (my email address is in my GitHub profile).

@Surbhi27946
Copy link
Author

Hi @EricWittmann
Raised the PR Apicurio/apicurio.github.io#11
Thanks

@EricWittmann
Copy link
Member

Fantastic, thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants