about summary refs log tree commit diff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/api/metadata.py3
-rw-r--r--gn3/app.py2
-rw-r--r--gn3/auth/__init__.py3
-rw-r--r--gn3/auth/authorisation/__init__.py2
-rw-r--r--gn3/auth/authorisation/errors.py42
-rw-r--r--gn3/case_attributes.py2
-rw-r--r--gn3/errors.py4
-rw-r--r--gn3/settings.py2
8 files changed, 5 insertions, 55 deletions
diff --git a/gn3/api/metadata.py b/gn3/api/metadata.py
index 6329c69..59c25d3 100644
--- a/gn3/api/metadata.py
+++ b/gn3/api/metadata.py
@@ -9,7 +9,8 @@ from flask import Blueprint
 from flask import request
 from flask import current_app
 
-from gn3.auth.authorisation.errors import AuthorisationError
+
+from gn3.oauth2.errors import AuthorisationError
 from gn3.db.datasets import (retrieve_metadata,
                              save_metadata,
                              get_history)
diff --git a/gn3/app.py b/gn3/app.py
index c8f0c5a..e9a2bbe 100644
--- a/gn3/app.py
+++ b/gn3/app.py
@@ -26,7 +26,6 @@ from gn3.api.search import search
 from gn3.api.metadata import metadata
 from gn3.api.sampledata import sampledata
 from gn3.api.llm import gnqa
-from gn3.auth import oauth2
 from gn3.case_attributes import caseattr
 
 
@@ -76,7 +75,6 @@ def create_app(config: Union[Dict, str, None] = None) -> Flask:
     app.register_blueprint(search, url_prefix="/api/search")
     app.register_blueprint(metadata, url_prefix="/api/metadata")
     app.register_blueprint(sampledata, url_prefix="/api/sampledata")
-    app.register_blueprint(oauth2, url_prefix="/api/oauth2")
     app.register_blueprint(caseattr, url_prefix="/api/case-attribute")
     app.register_blueprint(gnqa, url_prefix="/api/llm")
 
diff --git a/gn3/auth/__init__.py b/gn3/auth/__init__.py
index cd65e9b..d9caec9 100644
--- a/gn3/auth/__init__.py
+++ b/gn3/auth/__init__.py
@@ -1,4 +1 @@
 """Top-Level `Auth` module"""
-from . import authorisation
-
-from .views import oauth2
diff --git a/gn3/auth/authorisation/__init__.py b/gn3/auth/authorisation/__init__.py
deleted file mode 100644
index abd2747..0000000
--- a/gn3/auth/authorisation/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-"""The authorisation module."""
-from .checks import authorised_p
diff --git a/gn3/auth/authorisation/errors.py b/gn3/auth/authorisation/errors.py
deleted file mode 100644
index 3bc7a04..0000000
--- a/gn3/auth/authorisation/errors.py
+++ /dev/null
@@ -1,42 +0,0 @@
-"""Authorisation exceptions"""
-
-class AuthorisationError(Exception):
-    """
-    Top-level exception for the `gn3.auth.authorisation` package.
-
-    All exceptions in this package should inherit from this class.
-    """
-    error_code: int = 400
-
-class ForbiddenAccess(AuthorisationError):
-    """Raised for forbidden access."""
-    error_code: int = 403
-
-class UserRegistrationError(AuthorisationError):
-    """Raised whenever a user registration fails"""
-
-class NotFoundError(AuthorisationError):
-    """Raised whenever we try fetching (a/an) object(s) that do(es) not exist."""
-    error_code: int = 404
-
-class InvalidData(AuthorisationError):
-    """
-    Exception if user requests invalid data
-    """
-    error_code: int = 400
-
-class InconsistencyError(AuthorisationError):
-    """
-    Exception raised due to data inconsistencies
-    """
-    error_code: int = 500
-
-class PasswordError(AuthorisationError):
-    """
-    Raise in case of an error with passwords.
-    """
-
-class UsernameError(AuthorisationError):
-    """
-    Raise in case of an error with a user's name.
-    """
diff --git a/gn3/case_attributes.py b/gn3/case_attributes.py
index efc82e9..9baff1e 100644
--- a/gn3/case_attributes.py
+++ b/gn3/case_attributes.py
@@ -27,7 +27,7 @@ from gn3.commands import run_cmd
 from gn3.db_utils import Connection, database_connection
 
 from gn3.oauth2.authorisation import require_token
-from gn3.auth.authorisation.errors import AuthorisationError
+from gn3.oauth2.errors import AuthorisationError
 
 caseattr = Blueprint("case-attribute", __name__)
 
diff --git a/gn3/errors.py b/gn3/errors.py
index cd795e8..46483db 100644
--- a/gn3/errors.py
+++ b/gn3/errors.py
@@ -16,7 +16,7 @@ from authlib.oauth2.rfc6749.errors import OAuth2Error
 from flask import Flask, jsonify, Response, current_app
 
 from gn3.oauth2 import errors as oautherrors
-from gn3.auth.authorisation.errors import AuthorisationError
+from gn3.oauth2.errors import AuthorisationError
 from  gn3.llms.errors import LLMError
 
 def add_trace(exc: Exception, jsonmsg: dict) -> dict:
@@ -60,7 +60,7 @@ def handle_authorisation_error(exc: AuthorisationError):
     return jsonify(add_trace(exc, {
         "error": type(exc).__name__,
         "error_description": " :: ".join(exc.args)
-    })), exc.error_code
+    })), 500
 
 
 def handle_oauth2_errors(exc: OAuth2Error):
diff --git a/gn3/settings.py b/gn3/settings.py
index 04aa129..439d88c 100644
--- a/gn3/settings.py
+++ b/gn3/settings.py
@@ -85,8 +85,6 @@ MULTIPROCESSOR_PROCS = 6  # Number of processes to spawn
 
 AUTH_SERVER_URL = "https://auth.genenetwork.org"
 AUTH_MIGRATIONS = "migrations/auth"
-AUTH_DB = os.environ.get(
-    "AUTH_DB", f"{os.environ.get('HOME')}/genenetwork/gn3_files/db/auth.db")
 OAUTH2_SCOPE = (
     "profile", "group", "role", "resource", "user", "masquerade",
     "introspect")