Skip to content

Commit

Permalink
Update async security handler factory
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruwann committed Mar 18, 2022
1 parent 84c772b commit ac10089
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions connexion/security/async_security_handler_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,20 @@ def verify_security(cls, auth_funcs, function):
@functools.wraps(function)
async def wrapper(request):
token_info = cls.no_value
problem = None
errors = []
for func in auth_funcs:
try:
token_info = func(request)
while asyncio.iscoroutine(token_info):
token_info = await token_info
if token_info is not cls.no_value:
break
except (OAuthProblem, OAuthResponseProblem, OAuthScopeProblem) as err:
problem = err
except Exception as err:
errors += []

if token_info is cls.no_value:
if problem is not None:
raise problem
if errors != []:
cls._raise_most_specific(errors)
else:
logger.info("... No auth provided. Aborting with 401.")
raise OAuthProblem(description='No authorization token provided')
Expand Down

0 comments on commit ac10089

Please sign in to comment.