|
|
@ -52,6 +52,7 @@ class Dependant: |
|
|
# Lazy cached fields |
|
|
# Lazy cached fields |
|
|
_oauth_scopes_cache: list[str] = field(default=None, init=False, repr=False) |
|
|
_oauth_scopes_cache: list[str] = field(default=None, init=False, repr=False) |
|
|
_cache_key_cache: DependencyCacheKey = field(default=None, init=False, repr=False) |
|
|
_cache_key_cache: DependencyCacheKey = field(default=None, init=False, repr=False) |
|
|
|
|
|
_uses_scopes_cache: bool = field(default=None, init=False, repr=False) |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def oauth_scopes(self) -> list[str]: |
|
|
def oauth_scopes(self) -> list[str]: |
|
|
@ -79,18 +80,25 @@ class Dependant: |
|
|
|
|
|
|
|
|
return self._cache_key_cache |
|
|
return self._cache_key_cache |
|
|
|
|
|
|
|
|
@cached_property |
|
|
@property |
|
|
def _uses_scopes(self) -> bool: |
|
|
def _uses_scopes(self) -> bool: |
|
|
if self.own_oauth_scopes: |
|
|
if self._uses_scopes_cache is None: |
|
|
return True |
|
|
if self.own_oauth_scopes: |
|
|
if self.security_scopes_param_name is not None: |
|
|
self._uses_scopes_cache = True |
|
|
return True |
|
|
elif self.security_scopes_param_name is not None: |
|
|
if self._is_security_scheme: |
|
|
self._uses_scopes_cache = True |
|
|
return True |
|
|
elif self._is_security_scheme: |
|
|
for sub_dep in self.dependencies: |
|
|
self._uses_scopes_cache = True |
|
|
if sub_dep._uses_scopes: |
|
|
|
|
|
return True |
|
|
for sub_dep in self.dependencies: |
|
|
return False |
|
|
if sub_dep._uses_scopes: |
|
|
|
|
|
self._uses_scopes_cache = True |
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
if self._uses_scopes_cache is None: |
|
|
|
|
|
self._uses_scopes_cache = False |
|
|
|
|
|
|
|
|
|
|
|
return self._uses_scopes_cache |
|
|
|
|
|
|
|
|
@cached_property |
|
|
@cached_property |
|
|
def _is_security_scheme(self) -> bool: |
|
|
def _is_security_scheme(self) -> bool: |
|
|
|