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

troubleshooting keycloak

parent 3442f641
No related branches found
No related tags found
1 merge request!279Master
Pipeline #43780 passed
import os import os
import logging
logger = logging.getLogger(__name__)
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
...@@ -225,7 +227,7 @@ AUTHENTICATION_BACKENDS = [ ...@@ -225,7 +227,7 @@ AUTHENTICATION_BACKENDS = [
try: try:
KEYCLOAK_URL = os.environ['KEYCLOAK_URL'] KEYCLOAK_URL = os.environ['KEYCLOAK_URL']
except: except:
KEYCLOAK_URL = 'https://sdc-dev.astron.nl/auth' KEYCLOAK_URL = 'https://keycloak.astron.nl/auth'
SOCIALACCOUNT_PROVIDERS = { SOCIALACCOUNT_PROVIDERS = {
'keycloak': { 'keycloak': {
...@@ -238,9 +240,11 @@ SOCIALACCOUNT_PROVIDERS = { ...@@ -238,9 +240,11 @@ SOCIALACCOUNT_PROVIDERS = {
try: try:
LOGIN_REDIRECT_URL = os.environ['LOGIN_REDIRECT_URL'] LOGIN_REDIRECT_URL = os.environ['LOGIN_REDIRECT_URL']
except: except:
LOGIN_REDIRECT_URL = 'https://sdc-dev.astron.nl:5554/atdb/' LOGIN_REDIRECT_URL = 'https://sdc.astron.nl:5554/atdb/'
logger.info("LOGIN_REDIRECT_URL:" + LOGIN_REDIRECT_URL)
logger.info("KEYCLOAK_URL:" + KEYCLOAK_URL)
print("LOGIN_REDIRECT_URL:",LOGIN_REDIRECT_URL)
print("KEYCLOAK_URL:",KEYCLOAK_URL)
SESSION_COOKIE_NAME = 'my_service_name_session_id' SESSION_COOKIE_NAME = 'my_service_name_session_id'
CSRF_COOKIE_NAME = 'my_service_csrftoken' CSRF_COOKIE_NAME = 'my_service_csrftoken'
...@@ -25,3 +25,10 @@ DATABASES = { ...@@ -25,3 +25,10 @@ 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
...@@ -18,7 +18,7 @@ logger = logging.getLogger(__name__) ...@@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
@receiver(pre_save, sender=Task) @receiver(pre_save, sender=Task)
def pre_save_task_handler(sender, **kwargs): def pre_save_task_handler(sender, **kwargs):
logger.info("SIGNAL : pre_save Task(" + str(kwargs.get('instance')) + ")") #logger.info("SIGNAL : pre_save Task(" + str(kwargs.get('instance')) + ")")
handle_pre_save(sender, **kwargs) handle_pre_save(sender, **kwargs)
def handle_pre_save(sender, **kwargs): def handle_pre_save(sender, **kwargs):
...@@ -27,7 +27,7 @@ def handle_pre_save(sender, **kwargs): ...@@ -27,7 +27,7 @@ def handle_pre_save(sender, **kwargs):
:param (in) sender: The model class that sends the trigger :param (in) sender: The model class that sends the trigger
:param (in) kwargs: The instance of the object that sends the trigger. :param (in) kwargs: The instance of the object that sends the trigger.
""" """
logger.info("handle_pre_save(" + str(kwargs.get('instance')) + ")") #logger.info("handle_pre_save(" + str(kwargs.get('instance')) + ")")
myTaskObject = kwargs.get('instance') myTaskObject = kwargs.get('instance')
# IF this object does not exist yet, then abort, and let it first be handled by handle_post_save (get get a id). # IF this object does not exist yet, then abort, and let it first be handled by handle_post_save (get get a id).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment