From 986be944fd9f87566d94c1031b7c7dea0597195a Mon Sep 17 00:00:00 2001 From: TuxCoder Date: Sat, 30 May 2020 23:43:55 +0200 Subject: [PATCH] bugfixes --- import.py | 9 +++++++++ lenticular_cloud/model.py | 2 ++ lenticular_cloud/views/auth.py | 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 import.py diff --git a/import.py b/import.py new file mode 100644 index 0000000..b74c800 --- /dev/null +++ b/import.py @@ -0,0 +1,9 @@ +import logging +from lenticular_cloud.app import oidc_provider_init_app + +name = 'oidc_provider' +app = oidc_provider_init_app(name) +logging.basicConfig(level=logging.DEBUG) + +with app.context(): + diff --git a/lenticular_cloud/model.py b/lenticular_cloud/model.py index 3defc62..a9e84f2 100644 --- a/lenticular_cloud/model.py +++ b/lenticular_cloud/model.py @@ -254,6 +254,8 @@ class User(EntryBase): @property def email(self): + domain = current_app.config['DOMAIN'] + return f'{self.username}@{domain}' return self._ldap_object.mail @property diff --git a/lenticular_cloud/views/auth.py b/lenticular_cloud/views/auth.py index cc6265b..270b8ee 100644 --- a/lenticular_cloud/views/auth.py +++ b/lenticular_cloud/views/auth.py @@ -38,9 +38,10 @@ def consent(): requested_audiences = consent_request.requested_access_token_audience if form.validate_on_submit() or consent_request.skip: + user = User.query.get(consent_request.subject) token_data = { - 'preferred_username': str(current_user.username), - 'email': str(current_user.email), + 'preferred_username': str(user.username), + 'email': str(user.email), 'email_verified': True, } id_token_data = {}