Skipping session create with JWT based auth
According to NSX Authentication team's response in bug 2708018, we should not be using /api/session/create with JWT based auth, which will cause session create failed with 403 response. Change-Id: Ic09090d633301401906815743bbdd83b55212203
This commit is contained in:
parent
8deef1727e
commit
10366f00ba
@ -256,16 +256,10 @@ class NSXRequestsHTTPProvider(AbstractHTTPProvider):
|
||||
'Content-Type': 'application/x-www-form-urlencoded'}
|
||||
# Insert the JWT in Auth header if using tokens for auth
|
||||
if token_provider:
|
||||
try:
|
||||
token_value = token_provider.get_token()
|
||||
bearer_token = token_provider.get_header_value(token_value)
|
||||
token_header = {"Authorization": bearer_token}
|
||||
session.default_headers.update(token_header)
|
||||
req_headers.update(token_header)
|
||||
except exceptions.BadJSONWebTokenProviderRequest as e:
|
||||
LOG.error("Session create failed for endpoint %s due to "
|
||||
"error in retrieving JSON Web Token: %s",
|
||||
provider.url, e)
|
||||
# Don't call /api/session/create when using
|
||||
# JWT Token Based Principal Identity auth scheme
|
||||
LOG.debug("Skipping session create with JWT based auth")
|
||||
return
|
||||
else:
|
||||
# With client certificate authentication, username and password
|
||||
# may not be provided.
|
||||
|
Loading…
Reference in New Issue
Block a user