Skip to content

Commit b6350da

Browse files
committed
Add mock sync auth to avoid breaking the app
SDESK-7484
1 parent 3b2fcaa commit b6350da

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

content_api/app/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
from superdesk.validator import SuperdeskValidator
3030
from superdesk.factory.app import SuperdeskEve, set_error_handlers, get_media_storage_class
3131

32+
from content_api.tokens.auth import SyncMockTokenAuth
33+
3234

3335
def get_app(config=None):
3436
"""
@@ -62,6 +64,7 @@ def get_app(config=None):
6264
media_storage = get_media_storage_class(app_config)
6365

6466
app = SuperdeskEve(
67+
auth=SyncMockTokenAuth,
6568
settings=app_config,
6669
data=SuperdeskDataLayer,
6770
media=media_storage,

content_api/tokens/auth.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from typing import Any, cast
21
from quart_babel import _
2+
from eve.auth import TokenAuth
3+
34

45
from superdesk.utc import utcnow
56
from superdesk.core.types.web import Request
@@ -8,6 +9,13 @@
89
from superdesk.publish.subscriber_token import SubscriberTokenService, SubscriberToken
910

1011

12+
# TODO-ASYNC: remove this once everything is async in `content_api`
13+
# This is just a mock auth to avoid the app from breaking
14+
class SyncMockTokenAuth(TokenAuth):
15+
def check_auth(self, token, allowed_roles, resource, method):
16+
return True
17+
18+
1119
class SubscriberTokenAuth(UserAuthProtocol):
1220
def get_token_from_request(self, request: Request) -> str | None:
1321
"""

0 commit comments

Comments
 (0)