Skip to content

Commit

Permalink
Merge pull request #389 from globocom/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Malinoski authored May 27, 2024
2 parents fcf9caa + ba45152 commit 6849a81
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions networkapi/middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,18 @@ def process_request(self, request):
AuditRequest.new_request(request.get_full_path(), request.user,
ip, identity, context)
else:
user_auth_tuple = BasicAuthentication().authenticate(request)
try:
user_auth_tuple = BasicAuthentication().authenticate(request)
except Exception as ex:
user_auth_tuple = None

if user_auth_tuple is not None:
user, token = user_auth_tuple
else: # keeps compatibility with old authentication method
user = RestResource.authenticate_user(request)
try:
user = RestResource.authenticate_user(request)
except Exception as ex:
user = None

if user is not None:
ip = self._get_ip(request)
Expand Down

0 comments on commit 6849a81

Please sign in to comment.