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 keycloak setup information #103

Open
gannebamm opened this issue Jun 24, 2021 · 1 comment
Open

Add keycloak setup information #103

gannebamm opened this issue Jun 24, 2021 · 1 comment

Comments

@gannebamm
Copy link
Collaborator

From gitter https://gitter.im/GeoNode/general?at=60d32001f862a72a30cbad73

We should discuss were to put it

HOWTO Keycloak and GeoNode in Docker Compose on localhost

Goal
Starting with the docker-compose of GeoNode, add a Keycloak based authentication, with Keycloak as a container.

On the Keycloak side

You need to define the KEYCLOAK_FRONTEND_URL environment variable to http://localhost:YOURPORT/auth. If you don't do that, Keycloak will guess the URL by itself and the tokens won't work between the login form and the Django backend

For the client configuration, you can follow the instructions available here: https://github.com/GeoNode/geonode-contribs/tree/master/django-geonode-keycloak#django-allauth

On the GeoNode side
The Keycloak provider of django-allauth does not work in this case because it uses a unique URL for both the login form (which must be accessible by your browser) and the other URL used by the Django backend. I have implemented a feature with an additional setting KEYCLOAK_URL_ALT to be used by the Django backend.
A Pull Request is pending on django-allauth to integrate it: Meanwhile, you can use my fork at https://github.com/AlexGacon/django-allauth.
You need to have in the settings file the following addition to SOCIALACCOUNT_PROVIDERS:

SOCIALACCOUNT_PROVIDERS = {
   'keycloak': {
      'KEYCLOAK_URL': 'http://localhost:YOUR_PORT/auth',
      'KEYCLOAK_URL_ALT': 'http://KEY_CLOAK_DOCKER_SERVICE:8080/auth',
      'KEYCLOAK_REALM': 'YOUR_REALM'
   },
}

You also have to create in the Django administration page a Social App based on the Keycloak provider, with the client credentials configured in Keycloak.

@t-book
Copy link
Collaborator

t-book commented Jun 28, 2021

IMHO it should be added under: https://docs.geonode.org/en/master/usage/other_apps/index.html

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

No branches or pull requests

2 participants