aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-12-19 16:00:37 +0300
committerFrederick Muriuki Muriithi2022-12-21 06:13:41 +0300
commite9031e28594fcd21371adb2b9b26e17a1df95599 (patch)
treec53e180055047b667d6359278dc95f50836a4e9a
parent2a5d5ef7c0feab84cc3cd5d78f40e70050a49c00 (diff)
downloadgenenetwork3-e9031e28594fcd21371adb2b9b26e17a1df95599.tar.gz
auth: oauth2: users: Add expected property
* gn3/auth/authentication/users.py: authlib expects the user object to have a `get_user_id` method.
-rw-r--r--gn3/auth/authentication/users.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/gn3/auth/authentication/users.py b/gn3/auth/authentication/users.py
index 4adee61..11deba2 100644
--- a/gn3/auth/authentication/users.py
+++ b/gn3/auth/authentication/users.py
@@ -12,6 +12,10 @@ class User(NamedTuple):
email: str
name: str
+ def get_user_id(self):
+ """Return the user's UUID. Mostly for use with Authlib."""
+ return self.user_id
+
def user_by_email(conn: db.DbConnection, email: str) -> Maybe:
with db.cursor(conn) as cursor:
cursor.execute("SELECT * FROM users WHERE email=?", (email,))