Skip to content

Commit f538e85

Browse files
authored
[MNT] update auth0 (#1173)
* modify auth0 import paths (compose) * modify all auth0 import paths * fix usage
1 parent 8c53ac2 commit f538e85

File tree

8 files changed

+17
-15
lines changed

8 files changed

+17
-15
lines changed

compose/backend/neurosynth_compose/resources/analysis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def _make_json_response(payload, status=200):
7070

7171

7272
def create_user():
73-
from auth0.v3.authentication.users import Users
74-
from auth0.v3.exceptions import Auth0Error
73+
from auth0.authentication.users import Users
74+
from auth0.exceptions import Auth0Error
7575

7676
auth = request.headers.get("Authorization", None)
7777
if auth is None:
@@ -764,7 +764,7 @@ def _clone_project(self, source_id, copy_annotations):
764764

765765
access_token = request.headers.get("Authorization")
766766
if not access_token:
767-
from auth0.v3.authentication.get_token import GetToken
767+
from auth0.authentication.get_token import GetToken
768768

769769
domain = current_app.config["AUTH0_BASE_URL"].lstrip("https://")
770770
g_token = GetToken(domain)
@@ -1026,7 +1026,7 @@ def create_neurovault_collection(nv_collection):
10261026

10271027
def create_or_update_neurostore_study(ns_study):
10281028
from flask import request
1029-
from auth0.v3.authentication.get_token import GetToken
1029+
from auth0.authentication.get_token import GetToken
10301030
from .neurostore import neurostore_session
10311031

10321032
access_token = request.headers.get("Authorization")

compose/backend/neurosynth_compose/resources/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def file_upload_neurovault(self, fpath, id):
9090
def create_or_update_neurostore_analysis(
9191
self, ns_analysis_id, cluster_table, nv_collection_id, access_token
9292
):
93-
from auth0.v3.authentication.get_token import GetToken
93+
from auth0.authentication.get_token import GetToken
9494
import pandas as pd
9595
from .neurostore import neurostore_session
9696

compose/backend/neurosynth_compose/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from os import environ
1010
import pathlib
1111

12-
from auth0.v3.authentication import GetToken
12+
from auth0.authentication import GetToken
1313
import pytest
1414
from nimare.results import MetaResult
1515
import sqlalchemy as sa

compose/backend/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = [
1111
]
1212
license = { text = "MIT" }
1313
dependencies = [
14-
"auth0-python~=3.16",
14+
"auth0-python~=4.13",
1515
"authlib~=1.6",
1616
"celery~=5.0",
1717
"connexion[swagger-ui,uvicorn,flask]==3.0.0",

compose/scripts/add_usernames.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from auth0.v3.management.users import Users
1+
from auth0.management.users import Users
22
from neurosynth_compose.resources.users import User
33
from flask import current_app
44

store/backend/neurostore/resources/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def handle_parser_error(err, req, schema, *, error_status_code, error_headers):
5454

5555

5656
def create_user():
57-
from auth0.v3.authentication.users import Users
57+
from auth0.authentication.users import Users
5858

5959
auth = request.headers.get("Authorization", None)
6060
token = auth.split()[1]

store/backend/neurostore/tests/conftest.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
Entity,
2121
)
2222
from ..ingest.extracted_features import ingest_feature
23-
from auth0.v3.authentication import GetToken
24-
from auth0.v3.authentication.users import Users
23+
from auth0.authentication import GetToken
24+
from auth0.authentication.users import Users
2525
from unittest.mock import patch
2626

2727

@@ -377,7 +377,11 @@ def add_users(real_app, real_db):
377377
from neurostore.resources.auth import decode_token
378378

379379
domain = real_app.config["AUTH0_BASE_URL"].split("://")[1]
380-
token = GetToken(domain)
380+
token = GetToken(
381+
domain,
382+
real_app.config["AUTH0_CLIENT_ID"],
383+
real_app.config["AUTH0_CLIENT_SECRET"],
384+
)
381385

382386
users = [
383387
{
@@ -395,8 +399,6 @@ def add_users(real_app, real_db):
395399
name = u["name"]
396400
passw = u["password"]
397401
payload = token.login(
398-
client_id=real_app.config["AUTH0_CLIENT_ID"],
399-
client_secret=real_app.config["AUTH0_CLIENT_SECRET"],
400402
username=name + "@email.com",
401403
password=passw,
402404
realm="Username-Password-Authentication",

store/backend/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = [
1111
]
1212
license = { text = "MIT" }
1313
dependencies = [
14-
"auth0-python~=3.16",
14+
"auth0-python~=4.13",
1515
"authlib~=1.6",
1616
"connexion[swagger-ui,uvicorn,flask]==3.0.0",
1717
"flask~=3.1",

0 commit comments

Comments
 (0)