about summary refs log tree commit diff
path: root/gn_auth/auth/authentication/oauth2/models
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2026-08-27 10:51:16 -0500
committerFrederick Muriuki Muriithi2026-08-27 12:51:31 -0500
commit800913ddee45fcb0b0e3a9d8c3917d3cf9644ca4 (patch)
tree30b78dca5002899cce2d2f875bffe70a74933c87 /gn_auth/auth/authentication/oauth2/models
parentc9d6594750ad7a01b1e23af77e4f847e23f26306 (diff)
downloadgn-auth-800913ddee45fcb0b0e3a9d8c3917d3cf9644ca4.tar.gz
Cleanup deprecation warnings: Switch to gn_libs.sqlite3
The gn_auth.auth.db.sqlite3 module is deprecated and should be
removed. This cleanup goes a ways towards that goal.
Diffstat (limited to 'gn_auth/auth/authentication/oauth2/models')
-rw-r--r--gn_auth/auth/authentication/oauth2/models/jwt_bearer_token.py5
-rw-r--r--gn_auth/auth/authentication/oauth2/models/oauth2client.py2
-rw-r--r--gn_auth/auth/authentication/oauth2/models/oauth2token.py2
3 files changed, 6 insertions, 3 deletions
diff --git a/gn_auth/auth/authentication/oauth2/models/jwt_bearer_token.py b/gn_auth/auth/authentication/oauth2/models/jwt_bearer_token.py
index 71769e1..3a93265 100644
--- a/gn_auth/auth/authentication/oauth2/models/jwt_bearer_token.py
+++ b/gn_auth/auth/authentication/oauth2/models/jwt_bearer_token.py
@@ -3,9 +3,10 @@ import uuid
 import time
 from typing import Optional
 
+from flask import current_app as app
 from authlib.oauth2.rfc7523 import JWTBearerToken as _JWTBearerToken
+from gn_libs.sqlite3 import with_db_connection
 
-from gn_auth.auth.db.sqlite3 import with_db_connection
 from gn_auth.auth.authentication.users import user_by_id
 from gn_auth.auth.authentication.oauth2.models.oauth2client import (
     client as fetch_client)
@@ -19,8 +20,10 @@ class JWTBearerToken(_JWTBearerToken):
         #       OAuth2Client is a dataclass
         super().__init__(payload, header, options, params)
         self.user = with_db_connection(
+            app.config["SQL_URI"],
             lambda conn:user_by_id(conn, uuid.UUID(payload["sub"])))
         self.client = with_db_connection(
+            app.config["SQL_URI"],
             lambda conn: fetch_client(
                 conn, uuid.UUID(payload["oauth2_client_id"])
             )
diff --git a/gn_auth/auth/authentication/oauth2/models/oauth2client.py b/gn_auth/auth/authentication/oauth2/models/oauth2client.py
index b3ec91f..818399d 100644
--- a/gn_auth/auth/authentication/oauth2/models/oauth2client.py
+++ b/gn_auth/auth/authentication/oauth2/models/oauth2client.py
@@ -13,9 +13,9 @@ from requests.exceptions import JSONDecodeError
 from authlib.jose import KeySet, JsonWebKey
 from authlib.oauth2.rfc6749 import ClientMixin
 from pymonad.maybe import Just, Maybe, Nothing
+from gn_libs import sqlite3 as db
 from gn_libs.debug import make_peeker
 
-from gn_auth.auth.db import sqlite3 as db
 from gn_auth.auth.errors import NotFoundError
 from gn_auth.auth.authentication.users import (User,
                                                fetch_users,
diff --git a/gn_auth/auth/authentication/oauth2/models/oauth2token.py b/gn_auth/auth/authentication/oauth2/models/oauth2token.py
index 6ec5c3d..eb13f43 100644
--- a/gn_auth/auth/authentication/oauth2/models/oauth2token.py
+++ b/gn_auth/auth/authentication/oauth2/models/oauth2token.py
@@ -8,8 +8,8 @@ from typing import Optional
 from authlib.oauth2.rfc6749 import TokenMixin
 from pymonad.tools import monad_from_none_or_value
 from pymonad.maybe import Just, Maybe, Nothing
+from gn_libs import sqlite3 as db
 
-from gn_auth.auth.db import sqlite3 as db
 from gn_auth.auth.errors import NotFoundError
 from gn_auth.auth.authentication.users import User, user_by_id