Add http status_code 401 support

NSX has upgraded that Spring security. NSX will return 401 instead of
403 when the JWT token expired.
Handle status code 401 to apply for JWT again

Change-Id: I4824a9ea9487d5325bb020b9b54b414ab5a05132
This commit is contained in:
Tao Zou
2025-09-28 08:37:56 +08:00
parent b49988f87a
commit e8329e0f09

View File

@@ -127,6 +127,10 @@ def http_error_to_exception(status_code, error_code, related_error_codes=None):
{'98': exceptions.BadXSRFToken,
'403': exceptions.InvalidCredentials,
'505': exceptions.InvalidLicense},
requests.codes.UNAUTHORIZED:
{'98': exceptions.BadXSRFToken,
'403': exceptions.InvalidCredentials,
'505': exceptions.InvalidLicense},
requests.codes.TOO_MANY_REQUESTS: exceptions.TooManyRequests,
requests.codes.SERVICE_UNAVAILABLE: exceptions.ServiceUnavailable}