From 8508bd721ef12c4edab4581666f8aa1c350b1d7a Mon Sep 17 00:00:00 2001
From: Mark <mark@openappstack.net>
Date: Mon, 16 Sep 2019 17:34:59 +0200
Subject: [PATCH] Change subject to username

---
 consent_provider/app.py | 4 ++--
 login_provider/app.py   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/consent_provider/app.py b/consent_provider/app.py
index dd1b908..8c1cc28 100644
--- a/consent_provider/app.py
+++ b/consent_provider/app.py
@@ -15,8 +15,8 @@ def home():
     if not challenge:
         abort(400)
     consent_request = hydra.consent_request(challenge)
-    username = consent_request.client.client_name
-    app_name = consent_request.client.owner
+    app_name = consent_request.client["client_name"]
+    username = consent_request.subject
     user = User(username)
     access_granted = user.has_app_permission(app_name)
     if access_granted:
diff --git a/login_provider/app.py b/login_provider/app.py
index cff6f98..acec10d 100644
--- a/login_provider/app.py
+++ b/login_provider/app.py
@@ -31,7 +31,7 @@ def home():
     if not challenge:
         return render_template('home.html', email=current_user.email, logout_form=logout_form)
     else:
-        redirect_to = hydra.login_request(challenge).accept(current_user.email)
+        redirect_to = hydra.login_request(challenge).accept(current_user.username)
         return redirect(redirect_to)
 
 @app.route('/login', methods=['GET', 'POST'])
-- 
GitLab