From f521f7aec58defbf121a817e611f4bff18449882 Mon Sep 17 00:00:00 2001 From: Christian <59786962+christian-hawk@users.noreply.github.com> Date: Mon, 13 Mar 2023 05:43:36 -0300 Subject: [PATCH] feat(tent): support additional params (#4044) * test(register): mock register_client method was causing this test to break Signed-off-by: christian * test(tent): mock clienthandler methods Signed-off-by: christian * test(tent): move mocks to a separate helper method Signed-off-by: christian * chore(tent): bump deps httlib2, certifi, Authlib Signed-off-by: christian * test(tent): restore stashed register_client Signed-off-by: christian * test(tent): remove internet dependant Mocking also does not make sense Signed-off-by: christian * test(tent): remove login endpoint integration tests are unmockable Signed-off-by: christian * Set stable to v1.0.6 * chore: remove config.py from gitignore * refactor(tent): move config_dummy to config.py * feat(tent): support additional params Params will be loaded from config `ADDITIONAL_PARAMS` * ci: remove helm resources --------- Signed-off-by: christian Co-authored-by: mo-auto <54212639+mo-auto@users.noreply.github.com> Co-authored-by: moabu <47318409+moabu@users.noreply.github.com> --- demos/jans-tent/.gitignore | 1 - demos/jans-tent/clientapp/__init__.py | 5 +++ demos/jans-tent/clientapp/config.py | 52 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 demos/jans-tent/clientapp/config.py diff --git a/demos/jans-tent/.gitignore b/demos/jans-tent/.gitignore index 737d6fe053e..bb242e2b920 100644 --- a/demos/jans-tent/.gitignore +++ b/demos/jans-tent/.gitignore @@ -1,5 +1,4 @@ #auth-client-tdd-specific -clientapp/config.py clientapp/client_secrets.json # Byte-compiled / optimized / DLL files diff --git a/demos/jans-tent/clientapp/__init__.py b/demos/jans-tent/clientapp/__init__.py index 0817154500d..a92b592e88c 100644 --- a/demos/jans-tent/clientapp/__init__.py +++ b/demos/jans-tent/clientapp/__init__.py @@ -188,6 +188,11 @@ def login(): if cfg.PROVIDER_HOST_STRING is not None: query_args["providerHost"] = get_provider_host() + + if cfg.ADDITIONAL_PARAMS is not None: + query_args |= cfg.ADDITIONAL_PARAMS + + response = oauth.op.authorize_redirect(**query_args) app.logger.debug('/login authorize_redirect(redirect_uri) url = %s' % diff --git a/demos/jans-tent/clientapp/config.py b/demos/jans-tent/clientapp/config.py new file mode 100644 index 00000000000..ab6ce5ab1b0 --- /dev/null +++ b/demos/jans-tent/clientapp/config.py @@ -0,0 +1,52 @@ +''' +Project: Test Auth Client +Author: Christian Hawk +Copyright 2023 Christian Hawk + +Licensed under the Apache License, Version 2.0 (the 'License'); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an 'AS IS' BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +''' + +CLIENT_ID = "YOUR-CLIENT-ID" +CLIENT_SECRET = "YOUR-CLIENT-SECRET" +SERVER_META_URL = 'https://YOUR_OP_HOST/.well-known/openid-configuration' +REDIRECT_URIS = [ + 'https://localhost:9090/oidc_callback' +] + +USERINFO_URI = "https://your-userinfo-endpoint" + +ISSUER = "https://your-server-fqdn" + + +# Token authentication method can be +# client_secret_basic +# client_secret_post +# none + +SERVER_TOKEN_AUTH_METHOD = "client_secret_post" + +# for gluu +ACR_VALUES = 'agama' +PRE_SELECTED_PROVIDER = False +PRE_SELECTED_PROVIDER_ID = '' +HAS_PROVIDER_HOST = False +PROVIDER_HOST_STRING = None + +# ADDITIONAL PARAMS TO CALL AUTHORIZE ENDPOINT, WITHOUT BASE64 ENCODING. USE DICT {'param': 'value'} +# ADDITIONAL_PARAMS = {'paramOne': 'valueOne', 'paramTwo': 'valueTwo'} +ADDITIONAL_PARAMS = None + + +# SYSTEM SETTINGS +# use with caution, unsecure requests, for develpment environments +SSL_VERIFY = False