Skip to content

Tenant_id parsing is not working due to different response from API_KEY authentication in some usser #665

@biswazr

Description

@biswazr

self.tenant_id = token["tenant"]["id"]

there are few token which do not generate the needed response

{
  u'access': {
    u'token': {
      u'RAX-AUTH:authenticatedBy': [u'APIKEY'], 
      u'RAX-AUTH:issued': u'2022-09-08T07:07:07.616Z',
      u'expires': u'2022-09-09T06:58:44.616Z',
      u'id': '***REDACTED ***'
    },
u'serviceCatalog': [{u'endpoints': [{u'region': u'IAD', u'publicURL': u'https://global.metrics.api.rackspacecloud.com/v2.0/***REDACTED ***', u'tenantId': u'hybrid:00000'}], u'type': u'rax:cloudmetrics', u'name': u'cloudMetrics'}, {u'endpoints': [{u'publicURL': u'https://monitoring.api.rackspacecloud.com/v1.0/hybrid:***REDACTED ***', u'tenantId': u'hybrid:***REDACTED ***'}], u'type': u'rax:monitor', u'name': u'cloudMonitoring'}], u'user': {u'RAX-AUTH:domainId': u'dedicated:***REDACTED ***', u'RAX-AUTH:phonePinState': u'ACTIVE', u'name': u'***REDACTED ***', u'roles': [{u'id': u'***REDACTED ***', u'description': u'Monitoring Admin Role for Account User', u'name': u'monitoring:admin', u'tenantId': u'hybrid:***REDACTED ***'}, {u'id': u'16', u'description': u'a role that allows a user access to dedicated service methods', u'name': u'dedicated:default', u'tenantId': u'hybrid:***REDACTED ***'}, {u'id': u'***REDACTED ***', u'description': u'A role to grant visibility to a tenant', u'name': u'identity:tenant-access', u'tenantId': u'hybrid:00000'}, {u'id': u'2', u'name': u'identity:default', u'description': u'Default Role.'}], u'RAX-AUTH:phonePin': u'***REDACTED ***', u'email': u'***REDACTED ***', u'RAX-AUTH:sessionInactivityTimeout': u'PT12H', u'RAX-AUTH:defaultRegion': u'IAD', u'RAX-AUTH:contactId': u'***REDACTED ***', u'id': ***REDACTED ***'}}}

Values redacted to hide user detail but the response structure kept as it is

File "/Users/bisw8246/Desktop/repos/py2devtoolsenv2/lib/python2.7/site-packages/pyrax/identity/rax_identity.py", line 83, in authenticate password=password, api_key=api_key, tenant_id=tenant_id) File "/Users/bisw8246/Desktop/repos/py2devtoolsenv2/lib/python2.7/site-packages/pyrax/base_identity.py", line 622, in authenticate self._parse_response(resp_body) File "/Users/bisw8246/Desktop/repos/py2devtoolsenv2/lib/python2.7/site-packages/pyrax/identity/rax_identity.py", line 123, in _parse_response super(RaxIdentity, self)._parse_response(resp) File "/Users/bisw8246/Desktop/repos/py2devtoolsenv2/lib/python2.7/site-packages/pyrax/base_identity.py", line 631, in _parse_response self.tenant_id = token["tenant"]["id"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions