Skip to content

Commit a31451a

Browse files
committed
minimal fix
1 parent 8d97f36 commit a31451a

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

navigator/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
__description__ = (
55
"Navigator Web Framework based on aiohttp, " "with batteries included."
66
)
7-
__version__ = "2.14.8"
7+
__version__ = "2.14.9"
88
__copyright__ = "Copyright (c) 2020-2024 Jesus Lara"
99
__author__ = "Jesus Lara"
1010
__author_email__ = "jesuslarag@gmail.com"

navigator/views/abstract.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def service_auth(fn: Union[Any, Any]) -> Any:
378378
async def _wrap(self, *args, **kwargs):
379379
## get User Session:
380380
await self.session()
381-
if self._session:
381+
if self._session and self.request.get("authenticated", False):
382382
self._userid = await self.get_userid(self._session)
383383
# TODO: Checking User Permissions:
384384
## Calling post-authorization Model:
@@ -401,6 +401,10 @@ async def session(self):
401401
exception=err
402402
)
403403
if not self._session:
404+
# If the request was not marked as authenticated by middleware
405+
# (e.g., excluded endpoint), allow anonymous access.
406+
if not self.request.get("authenticated", False):
407+
return None
404408
# TODO: add support for service tokens
405409
if hasattr(self.model.Meta, 'allowed_methods'):
406410
if self.request.method in self.model.Meta.allowed_methods:

navigator/views/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def service_auth(fn: Union[Any, Any]) -> Any:
107107
async def _wrap(self, *args, **kwargs):
108108
## get User Session:
109109
await self.session()
110-
if self._session:
110+
if self._session and self.request.get("authenticated", False):
111111
self._userid = await self.get_userid(self._session)
112112
# TODO: Checking User Permissions:
113113
## Calling post-authorization Model:

0 commit comments

Comments
 (0)