From c0db8ccf1be0d43c437fc9e5090e49329a6b2911 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 20 Jan 2023 11:42:49 +0300 Subject: auth: Setup the user correctly * gn3/auth/authentication/oauth2/grants/password_grant.py: Return user rather than boolean * gn3/auth/authentication/oauth2/models/oauth2client.py: provide optional `user` argument to allow flexibility in setting up the client's user * gn3/auth/authentication/oauth2/models/oauth2token.py: Set token and client user correctly * gn3/auth/authentication/oauth2/server.py: Set token user from the request --- gn3/auth/authentication/oauth2/grants/password_grant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3/auth/authentication/oauth2/grants') diff --git a/gn3/auth/authentication/oauth2/grants/password_grant.py b/gn3/auth/authentication/oauth2/grants/password_grant.py index 91fdb7c..3ec7384 100644 --- a/gn3/auth/authentication/oauth2/grants/password_grant.py +++ b/gn3/auth/authentication/oauth2/grants/password_grant.py @@ -15,4 +15,4 @@ class PasswordGrant(grants.ResourceOwnerPasswordCredentialsGrant): with db.connection(app.config["AUTH_DB"]) as conn: return user_by_email(conn, username).maybe( None, - lambda user: valid_login(conn, user, password)) + lambda user: valid_login(conn, user, password) and user) -- cgit v1.2.3