File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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"
Original file line number Diff line number Diff 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 :
Original file line number Diff line number Diff 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:
You can’t perform that action at this time.
0 commit comments