From e9031e28594fcd21371adb2b9b26e17a1df95599 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 19 Dec 2022 16:00:37 +0300 Subject: auth: oauth2: users: Add expected property * gn3/auth/authentication/users.py: authlib expects the user object to have a `get_user_id` method. --- gn3/auth/authentication/users.py | 4 ++++ 1 file changed, 4 insertions(+) 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,)) -- cgit v1.2.3