From c7a8da7e9b9d2dee5a33523e9017455181eacff2 Mon Sep 17 00:00:00 2001 From: travis-infosec Date: Mon, 20 Dec 2021 15:58:31 -0600 Subject: [PATCH 1/6] modified to prevent this requirements conflict --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 24ec76a..37e348e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,11 +34,11 @@ Pygments==2.7.2 python-jose==3.0.1 python-jwt==3.2.4 python-keycloak==0.17.6 -requests==2.22.0 +requests==2.26.0 rsa==4.0 six==1.15.0 traitlets==4.3.3 -urllib3==1.26.2 +urllib3==1.26.7 wcwidth==0.1.7 Werkzeug==0.16.0 WTForms==2.2.1 From fb1f706ce8f2a7e92e7bdb2463c37f565a81d06b Mon Sep 17 00:00:00 2001 From: travis-infosec Date: Mon, 20 Dec 2021 21:45:51 -0600 Subject: [PATCH 2/6] tentative docker-compose file - seems to work --- docker-compose-local.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docker-compose-local.yml diff --git a/docker-compose-local.yml b/docker-compose-local.yml new file mode 100644 index 0000000..1fea302 --- /dev/null +++ b/docker-compose-local.yml @@ -0,0 +1,16 @@ +version: '3' + +services: + keycloak-flask: + restart: "unless-stopped" + build: . + environment: + - FLASK_APP=keycloak_flask.user + - FLASK_DEBUG=1 + - KEYCLOAK_FLASK_SETTINGS=local_settings.py + ports: + - "5000:5000" + +networks: + kitt: + external: true From f5e8494c2dcde80e98398a5f61cc248c82a38ee0 Mon Sep 17 00:00:00 2001 From: travis-infosec Date: Tue, 21 Dec 2021 21:17:33 -0600 Subject: [PATCH 3/6] working! --- docker-compose-local.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-compose-local.yml b/docker-compose-local.yml index 1fea302..a5cfc26 100644 --- a/docker-compose-local.yml +++ b/docker-compose-local.yml @@ -1,7 +1,7 @@ version: '3' services: - keycloak-flask: + keycloak_flask: restart: "unless-stopped" build: . environment: @@ -10,6 +10,8 @@ services: - KEYCLOAK_FLASK_SETTINGS=local_settings.py ports: - "5000:5000" + networks: + - kitt networks: kitt: From 55dd335d849ea47d41c0991265c7769077a5ab8c Mon Sep 17 00:00:00 2001 From: travis-infosec Date: Tue, 21 Dec 2021 21:21:34 -0600 Subject: [PATCH 4/6] defaults --- keycloak_flask/settings.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/keycloak_flask/settings.py b/keycloak_flask/settings.py index 31088dc..dcbf813 100644 --- a/keycloak_flask/settings.py +++ b/keycloak_flask/settings.py @@ -1,12 +1,15 @@ # for local +# It's probably helpful for us to demonstrate what the URL should be, etc. -SECRET_KEY = b'' +SECRET_KEY = b'keycloak' -SERVER_URL = "" -ADMIN_USERNAME = "" -ADMIN_PASS = "" -REALM_NAME = "" -CLIENT_ID = "" +# http, not https for some reason +SERVER_URL = "http://keycloak-idp:8080/auth/" +ADMIN_USERNAME = "admin" +ADMIN_PASS = "admin" +REALM_NAME = "master" +# created in keycloak per https://github.com/keycloak/keycloak-documentation/blob/main/securing_apps/topics/client-registration/client-registration-cli.adoc +CLIENT_ID = "keycloak-flask" CLIENT_SECRET = "" -INGRESS_HOST = "" +INGRESS_HOST = "https://www.google.com/" From f588070ca6d6a90317466f16f878a94bc84e6879 Mon Sep 17 00:00:00 2001 From: travis-infosec Date: Tue, 21 Dec 2021 21:40:45 -0600 Subject: [PATCH 5/6] exmaple settings --- keycloak_flask/settings.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/keycloak_flask/settings.py b/keycloak_flask/settings.py index dcbf813..3286ae1 100644 --- a/keycloak_flask/settings.py +++ b/keycloak_flask/settings.py @@ -10,6 +10,7 @@ REALM_NAME = "master" # created in keycloak per https://github.com/keycloak/keycloak-documentation/blob/main/securing_apps/topics/client-registration/client-registration-cli.adoc CLIENT_ID = "keycloak-flask" -CLIENT_SECRET = "" +# set access-type to confidential, save, reload, will see a credentials tab where you can set this +CLIENT_SECRET = "2da4a9a4-f6f0-48d9-82f6-12012402f03a" -INGRESS_HOST = "https://www.google.com/" +INGRESS_HOST = "http://www.google.com/" From 7da96c521fdf6a90437b8b1da44e2ba1b9cfb24c Mon Sep 17 00:00:00 2001 From: travis-infosec Date: Tue, 21 Dec 2021 21:41:23 -0600 Subject: [PATCH 6/6] more example verbiage --- keycloak_flask/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/keycloak_flask/settings.py b/keycloak_flask/settings.py index 3286ae1..77b6047 100644 --- a/keycloak_flask/settings.py +++ b/keycloak_flask/settings.py @@ -13,4 +13,5 @@ # set access-type to confidential, save, reload, will see a credentials tab where you can set this CLIENT_SECRET = "2da4a9a4-f6f0-48d9-82f6-12012402f03a" +# You'll probably have to tell docker this is OK on a Mac INGRESS_HOST = "http://www.google.com/"