Skip to content
Snippets Groups Projects
Commit f9c896a6 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

Merge branch 'master' into 'SDC-1005-multiple-summary-structures'

merge keycloak changes into branch

See merge request !323
parents bc0ce88c aec43761
No related branches found
No related tags found
2 merge requests!324Merge branch 'master' into 'SDC-1005-multiple-summary-structures',!323merge keycloak changes into branch
Pipeline #59869 passed
...@@ -45,8 +45,7 @@ INSTALLED_APPS = [ ...@@ -45,8 +45,7 @@ INSTALLED_APPS = [
'allauth', 'allauth',
'allauth.account', 'allauth.account',
'allauth.socialaccount', 'allauth.socialaccount',
'allauth.socialaccount.providers.keycloak', 'allauth.socialaccount.providers.openid_connect',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
...@@ -59,6 +58,7 @@ MIDDLEWARE = [ ...@@ -59,6 +58,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'allauth.account.middleware.AccountMiddleware',
#'silk.middleware.SilkyMiddleware', #'silk.middleware.SilkyMiddleware',
] ]
...@@ -228,17 +228,27 @@ AUTHENTICATION_BACKENDS = [ ...@@ -228,17 +228,27 @@ AUTHENTICATION_BACKENDS = [
"allauth.account.auth_backends.AuthenticationBackend", "allauth.account.auth_backends.AuthenticationBackend",
] ]
try: # Set your keycloak url and realm
KEYCLOAK_URL = os.environ['KEYCLOAK_URL']
except:
KEYCLOAK_URL = 'https://keycloak.astron.nl/auth'
SOCIALACCOUNT_PROVIDERS = { SOCIALACCOUNT_PROVIDERS = {
'keycloak': { "openid_connect": {
'KEYCLOAK_URL': KEYCLOAK_URL, "SERVERS": [
'KEYCLOAK_REALM': 'SDC', {
'SCOPE': ['openid', 'profile', 'email'] "id": "keycloak",
"name": "Keycloak",
"server_url": os.getenv(
"KEYCLOAK_URL", "https://keycloak.astron.nl/auth"
)
+ "/realms/"
+ os.getenv("KEYCLOAK_REALM", "SDC")
+ "/.well-known/openid-configuration",
"APP": {
"client_id": os.getenv("KEYCLOAK_CLIENT_ID"),
"secret": os.getenv("KEYCLOAK_CLIENT_SECRET"),
},
"SCOPE": ["openid", "profile", "email"],
} }
]
},
} }
try: try:
...@@ -247,7 +257,6 @@ except: ...@@ -247,7 +257,6 @@ except:
LOGIN_REDIRECT_URL = '/atdb/' LOGIN_REDIRECT_URL = '/atdb/'
logger.info("LOGIN_REDIRECT_URL:" + LOGIN_REDIRECT_URL) logger.info("LOGIN_REDIRECT_URL:" + LOGIN_REDIRECT_URL)
logger.info("KEYCLOAK_URL:" + KEYCLOAK_URL)
SESSION_COOKIE_NAME = 'atdb_session_id' SESSION_COOKIE_NAME = 'atdb_session_id'
......
...@@ -13,8 +13,6 @@ DATABASES = { ...@@ -13,8 +13,6 @@ DATABASES = {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'atdb_admin', 'USER': 'atdb_admin',
'PASSWORD': 'atdb123', 'PASSWORD': 'atdb123',
#'NAME': 'atdb_ldv_astronauth_6feb2023',
#'NAME': 'atdb_ldv_27jun2023',
'NAME': 'atdb_ldv_8aug2023', 'NAME': 'atdb_ldv_8aug2023',
'HOST': 'localhost', 'HOST': 'localhost',
'PORT': '5432', 'PORT': '5432',
...@@ -27,10 +25,3 @@ DATABASES = { ...@@ -27,10 +25,3 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [] AUTH_PASSWORD_VALIDATORS = []
LOGIN_REDIRECT_URL = "http://localhost:8000/atdb" LOGIN_REDIRECT_URL = "http://localhost:8000/atdb"
SOCIALACCOUNT_PROVIDERS = {
'keycloak': {
'KEYCLOAK_URL': 'https://sdc-dev.astron.nl/auth',
'KEYCLOAK_REALM': 'SDC',
'SCOPE': ['openid', 'profile', 'email']
}
}
\ No newline at end of file
astronauth==0.3.3 astronauth==0.3.3
Django==3.2 Django==3.2
django-allauth==0.52.0 django-allauth==0.57.0 # note allauth only supports Django >= 3.2
django-bootstrap-pagination==1.7.0 django-bootstrap-pagination==1.7.0
django-bootstrap3==14.2.0 django-bootstrap3==14.2.0
django-cors-headers==3.6.0 django-cors-headers==3.6.0
......
SET DEBUG=True
SET DATABASE_HOST=localhost
SET DATABASE_PORT=5432
SET DATABASE_NAME=atdb_ldv
SET DATABASE_USER=atdb_admin
SET DATABASE_PASSWORD=atdb123
python manage.py runserver --settings=atdb.settings.dev
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
{% include 'taskdatabase/pagination.html' %} {% include 'taskdatabase/pagination.html' %}
</div> </div>
</div> </div>
<p class="footer"> Version 31 Aug 2023 <p class="footer"> Version 3 Oct 2023
</div> </div>
{% include 'taskdatabase/refresh.html' %} {% include 'taskdatabase/refresh.html' %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment