We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
KeyError querying 'Address' key out of the CyberArk object using CyberArk Central Credential Provider Lookup
### Please confirm the following

- [X] I agree to follow this project's [code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html).
- [X] I have checked the [current issues](https://github.com/ansible/awx/issues) for duplicates.
- [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.
- [X] I am **NOT** reporting a (potential) security vulnerability. (These should be emailed to `security@ansible.com` instead.)

### Bug Summary

Using AWX 23.3.0 and trying to fetch a credential (account) 'Address' from CyberARK PAM using Central Credential Provider version 12.6 we encounter a KeyError.

Fetching object property '' ('Content') or 'UserName' works flawlessly and using PowerShell the same query works and Address field in the JSON response is there and has the proper value.

related #13411
related #13402
related #5743

### AWX version

23.3.0

### Select the relevant components

- [X] UI
- [ ] UI (tech preview)
- [X] API
- [ ] Docs
- [ ] Collection
- [ ] CLI
- [ ] Other

### Installation method

kubernetes

### Modifications

no

### Ansible version

core 2.12.5.post0

### Operating system

CentOS Stream release 8

### Web browser

Chrome

### Steps to reproduce

Reproduceable with a CyberARK PAM account that has the Address field populated and an AWX credential of Credential Type "VMware vCenter" passing through the lookup of the 'VCenter Host' details using AIM (External Secret Management System) to a self managed safe using this data:

```
{
  "reason": "no particular",
  "object_query": "Safe=XXXXXX_Self;Object=awx-vcenter-test",
  "object_property": "Address",
  "object_query_format": "Exact"
}
```





### Expected results

env var VMWARE_HOST set with the value in the Address field of the CyberArk credential

### Actual results

Test button in Credential Edit->External Secret Management System->Metadata page will show a KeyError pop up, and playbook in debug mode using this credential fails with these messages:

```
Traceback (most recent call last):
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/jobs.py", line 528, in run
    credential.credential_type.inject_credential(credential, env, self.safe_cred_env, args, private_data_dir)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/__init__.py", line 455, in inject_credential
    getattr(builtin_injectors, credential.credential_type.namespace)(credential, injected_env, private_data_dir)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/injectors.py", line 71, in vmware
    env['VMWARE_HOST'] = cred.get_input('host', default='')
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/__init__.py", line 279, in get_input
    return self._get_dynamic_input(field_name)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/__init__.py", line 313, in _get_dynamic_input
    return input_source.get_input_value()
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/__init__.py", line 1258, in get_input_value
    return backend(**backend_kwargs)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/credential_plugins/aim.py", line 115, in aim_backend
    raise KeyError('Property {} not found in object'.format(object_property))
KeyError: 'Property Address not found in object'
```

### Additional information

Using another instance (same versions AWX and CCP) we can reproduce this error.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `awx/main/credential_plugins/aim.py`
Content:
```
1 from .plugin import CredentialPlugin, CertFiles, raise_for_status
2 
3 from urllib.parse import quote, urlencode, urljoin
4 
5 from django.utils.translation import gettext_lazy as _
6 import requests
7 
8 aim_inputs = {
9     'fields': [
10         {
11             'id': 'url',
12             'label': _('CyberArk CCP URL'),
13             'type': 'string',
14             'format': 'url',
15         },
16         {
17             'id': 'webservice_id',
18             'label': _('Web Service ID'),
19             'type': 'string',
20             'help_text': _('The CCP Web Service ID. Leave blank to default to AIMWebService.'),
21         },
22         {
23             'id': 'app_id',
24             'label': _('Application ID'),
25             'type': 'string',
26             'secret': True,
27         },
28         {
29             'id': 'client_key',
30             'label': _('Client Key'),
31             'type': 'string',
32             'secret': True,
33             'multiline': True,
34         },
35         {
36             'id': 'client_cert',
37             'label': _('Client Certificate'),
38             'type': 'string',
39             'secret': True,
40             'multiline': True,
41         },
42         {
43             'id': 'verify',
44             'label': _('Verify SSL Certificates'),
45             'type': 'boolean',
46             'default': True,
47         },
48     ],
49     'metadata': [
50         {
51             'id': 'object_query',
52             'label': _('Object Query'),
53             'type': 'string',
54             'help_text': _('Lookup query for the object. Ex: Safe=TestSafe;Object=testAccountName123'),
55         },
56         {'id': 'object_query_format', 'label': _('Object Query Format'), 'type': 'string', 'default': 'Exact', 'choices': ['Exact', 'Regexp']},
57         {
58             'id': 'object_property',
59             'label': _('Object Property'),
60             'type': 'string',
61             'help_text': _('The property of the object to return. Default: Content Ex: Username, Address, etc.'),
62         },
63         {
64             'id': 'reason',
65             'label': _('Reason'),
66             'type': 'string',
67             'help_text': _('Object request reason. This is only needed if it is required by the object\'s policy.'),
68         },
69     ],
70     'required': ['url', 'app_id', 'object_query'],
71 }
72 
73 
74 def aim_backend(**kwargs):
75     url = kwargs['url']
76     client_cert = kwargs.get('client_cert', None)
77     client_key = kwargs.get('client_key', None)
78     verify = kwargs['verify']
79     webservice_id = kwargs.get('webservice_id', '')
80     app_id = kwargs['app_id']
81     object_query = kwargs['object_query']
82     object_query_format = kwargs['object_query_format']
83     object_property = kwargs.get('object_property', '')
84     reason = kwargs.get('reason', None)
85     if webservice_id == '':
86         webservice_id = 'AIMWebService'
87 
88     query_params = {
89         'AppId': app_id,
90         'Query': object_query,
91         'QueryFormat': object_query_format,
92     }
93     if reason:
94         query_params['reason'] = reason
95 
96     request_qs = '?' + urlencode(query_params, quote_via=quote)
97     request_url = urljoin(url, '/'.join([webservice_id, 'api', 'Accounts']))
98 
99     with CertFiles(client_cert, client_key) as cert:
100         res = requests.get(
101             request_url + request_qs,
102             timeout=30,
103             cert=cert,
104             verify=verify,
105             allow_redirects=False,
106         )
107     raise_for_status(res)
108     # CCP returns the property name capitalized, username is camel case
109     # so we need to handle that case
110     if object_property == '':
111         object_property = 'Content'
112     elif object_property.lower() == 'username':
113         object_property = 'UserName'
114     elif object_property not in res:
115         raise KeyError('Property {} not found in object'.format(object_property))
116     else:
117         object_property = object_property.capitalize()
118 
119     return res.json()[object_property]
120 
121 
122 aim_plugin = CredentialPlugin('CyberArk Central Credential Provider Lookup', inputs=aim_inputs, backend=aim_backend)
123
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/awx/main/credential_plugins/aim.py b/awx/main/credential_plugins/aim.py
--- a/awx/main/credential_plugins/aim.py
+++ b/awx/main/credential_plugins/aim.py
@@ -58,7 +58,7 @@
             'id': 'object_property',
             'label': _('Object Property'),
             'type': 'string',
-            'help_text': _('The property of the object to return. Default: Content Ex: Username, Address, etc.'),
+            'help_text': _('The property of the object to return. Available properties: Username, Password and Address.'),
         },
         {
             'id': 'reason',
@@ -111,8 +111,12 @@
         object_property = 'Content'
     elif object_property.lower() == 'username':
         object_property = 'UserName'
+    elif object_property.lower() == 'password':
+        object_property = 'Content'
+    elif object_property.lower() == 'address':
+        object_property = 'Address'
     elif object_property not in res:
-        raise KeyError('Property {} not found in object'.format(object_property))
+        raise KeyError('Property {} not found in object, available properties: Username, Password and Address'.format(object_property))
     else:
         object_property = object_property.capitalize()

{"golden_diff": "diff --git a/awx/main/credential_plugins/aim.py b/awx/main/credential_plugins/aim.py\n--- a/awx/main/credential_plugins/aim.py\n+++ b/awx/main/credential_plugins/aim.py\n@@ -58,7 +58,7 @@\n             'id': 'object_property',\n             'label': _('Object Property'),\n             'type': 'string',\n-            'help_text': _('The property of the object to return. Default: Content Ex: Username, Address, etc.'),\n+            'help_text': _('The property of the object to return. Available properties: Username, Password and Address.'),\n         },\n         {\n             'id': 'reason',\n@@ -111,8 +111,12 @@\n         object_property = 'Content'\n     elif object_property.lower() == 'username':\n         object_property = 'UserName'\n+    elif object_property.lower() == 'password':\n+        object_property = 'Content'\n+    elif object_property.lower() == 'address':\n+        object_property = 'Address'\n     elif object_property not in res:\n-        raise KeyError('Property {} not found in object'.format(object_property))\n+        raise KeyError('Property {} not found in object, available properties: Username, Password and Address'.format(object_property))\n     else:\n         object_property = object_property.capitalize()\n", "issue": "KeyError querying 'Address' key out of the CyberArk object using CyberArk Central Credential Provider Lookup\n### Please confirm the following\r\n\r\n- [X] I agree to follow this project's [code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html).\r\n- [X] I have checked the [current issues](https://github.com/ansible/awx/issues) for duplicates.\r\n- [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.\r\n- [X] I am **NOT** reporting a (potential) security vulnerability. (These should be emailed to `security@ansible.com` instead.)\r\n\r\n### Bug Summary\r\n\r\nUsing AWX 23.3.0 and trying to fetch a credential (account) 'Address' from CyberARK PAM using Central Credential Provider version 12.6 we encounter a KeyError.\r\n\r\nFetching object property '' ('Content') or 'UserName' works flawlessly and using PowerShell the same query works and Address field in the JSON response is there and has the proper value.\r\n\r\nrelated #13411\r\nrelated #13402\r\nrelated #5743\r\n\r\n### AWX version\r\n\r\n23.3.0\r\n\r\n### Select the relevant components\r\n\r\n- [X] UI\r\n- [ ] UI (tech preview)\r\n- [X] API\r\n- [ ] Docs\r\n- [ ] Collection\r\n- [ ] CLI\r\n- [ ] Other\r\n\r\n### Installation method\r\n\r\nkubernetes\r\n\r\n### Modifications\r\n\r\nno\r\n\r\n### Ansible version\r\n\r\ncore 2.12.5.post0\r\n\r\n### Operating system\r\n\r\nCentOS Stream release 8\r\n\r\n### Web browser\r\n\r\nChrome\r\n\r\n### Steps to reproduce\r\n\r\nReproduceable with a CyberARK PAM account that has the Address field populated and an AWX credential of Credential Type \"VMware vCenter\" passing through the lookup of the 'VCenter Host' details using AIM (External Secret Management System) to a self managed safe using this data:\r\n\r\n```\r\n{\r\n  \"reason\": \"no particular\",\r\n  \"object_query\": \"Safe=XXXXXX_Self;Object=awx-vcenter-test\",\r\n  \"object_property\": \"Address\",\r\n  \"object_query_format\": \"Exact\"\r\n}\r\n```\r\n\r\n\r\n\r\n\r\n\r\n### Expected results\r\n\r\nenv var VMWARE_HOST set with the value in the Address field of the CyberArk credential\r\n\r\n### Actual results\r\n\r\nTest button in Credential Edit->External Secret Management System->Metadata page will show a KeyError pop up, and playbook in debug mode using this credential fails with these messages:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/jobs.py\", line 528, in run\r\n    credential.credential_type.inject_credential(credential, env, self.safe_cred_env, args, private_data_dir)\r\n  File \"/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/__init__.py\", line 455, in inject_credential\r\n    getattr(builtin_injectors, credential.credential_type.namespace)(credential, injected_env, private_data_dir)\r\n  File \"/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/injectors.py\", line 71, in vmware\r\n    env['VMWARE_HOST'] = cred.get_input('host', default='')\r\n  File \"/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/__init__.py\", line 279, in get_input\r\n    return self._get_dynamic_input(field_name)\r\n  File \"/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/__init__.py\", line 313, in _get_dynamic_input\r\n    return input_source.get_input_value()\r\n  File \"/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/credential/__init__.py\", line 1258, in get_input_value\r\n    return backend(**backend_kwargs)\r\n  File \"/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/credential_plugins/aim.py\", line 115, in aim_backend\r\n    raise KeyError('Property {} not found in object'.format(object_property))\r\nKeyError: 'Property Address not found in object'\r\n```\r\n\r\n### Additional information\r\n\r\nUsing another instance (same versions AWX and CCP) we can reproduce this error.\n", "before_files": [{"content": "from .plugin import CredentialPlugin, CertFiles, raise_for_status\n\nfrom urllib.parse import quote, urlencode, urljoin\n\nfrom django.utils.translation import gettext_lazy as _\nimport requests\n\naim_inputs = {\n    'fields': [\n        {\n            'id': 'url',\n            'label': _('CyberArk CCP URL'),\n            'type': 'string',\n            'format': 'url',\n        },\n        {\n            'id': 'webservice_id',\n            'label': _('Web Service ID'),\n            'type': 'string',\n            'help_text': _('The CCP Web Service ID. Leave blank to default to AIMWebService.'),\n        },\n        {\n            'id': 'app_id',\n            'label': _('Application ID'),\n            'type': 'string',\n            'secret': True,\n        },\n        {\n            'id': 'client_key',\n            'label': _('Client Key'),\n            'type': 'string',\n            'secret': True,\n            'multiline': True,\n        },\n        {\n            'id': 'client_cert',\n            'label': _('Client Certificate'),\n            'type': 'string',\n            'secret': True,\n            'multiline': True,\n        },\n        {\n            'id': 'verify',\n            'label': _('Verify SSL Certificates'),\n            'type': 'boolean',\n            'default': True,\n        },\n    ],\n    'metadata': [\n        {\n            'id': 'object_query',\n            'label': _('Object Query'),\n            'type': 'string',\n            'help_text': _('Lookup query for the object. Ex: Safe=TestSafe;Object=testAccountName123'),\n        },\n        {'id': 'object_query_format', 'label': _('Object Query Format'), 'type': 'string', 'default': 'Exact', 'choices': ['Exact', 'Regexp']},\n        {\n            'id': 'object_property',\n            'label': _('Object Property'),\n            'type': 'string',\n            'help_text': _('The property of the object to return. Default: Content Ex: Username, Address, etc.'),\n        },\n        {\n            'id': 'reason',\n            'label': _('Reason'),\n            'type': 'string',\n            'help_text': _('Object request reason. This is only needed if it is required by the object\\'s policy.'),\n        },\n    ],\n    'required': ['url', 'app_id', 'object_query'],\n}\n\n\ndef aim_backend(**kwargs):\n    url = kwargs['url']\n    client_cert = kwargs.get('client_cert', None)\n    client_key = kwargs.get('client_key', None)\n    verify = kwargs['verify']\n    webservice_id = kwargs.get('webservice_id', '')\n    app_id = kwargs['app_id']\n    object_query = kwargs['object_query']\n    object_query_format = kwargs['object_query_format']\n    object_property = kwargs.get('object_property', '')\n    reason = kwargs.get('reason', None)\n    if webservice_id == '':\n        webservice_id = 'AIMWebService'\n\n    query_params = {\n        'AppId': app_id,\n        'Query': object_query,\n        'QueryFormat': object_query_format,\n    }\n    if reason:\n        query_params['reason'] = reason\n\n    request_qs = '?' + urlencode(query_params, quote_via=quote)\n    request_url = urljoin(url, '/'.join([webservice_id, 'api', 'Accounts']))\n\n    with CertFiles(client_cert, client_key) as cert:\n        res = requests.get(\n            request_url + request_qs,\n            timeout=30,\n            cert=cert,\n            verify=verify,\n            allow_redirects=False,\n        )\n    raise_for_status(res)\n    # CCP returns the property name capitalized, username is camel case\n    # so we need to handle that case\n    if object_property == '':\n        object_property = 'Content'\n    elif object_property.lower() == 'username':\n        object_property = 'UserName'\n    elif object_property not in res:\n        raise KeyError('Property {} not found in object'.format(object_property))\n    else:\n        object_property = object_property.capitalize()\n\n    return res.json()[object_property]\n\n\naim_plugin = CredentialPlugin('CyberArk Central Credential Provider Lookup', inputs=aim_inputs, backend=aim_backend)\n", "path": "awx/main/credential_plugins/aim.py"}], "after_files": [{"content": "from .plugin import CredentialPlugin, CertFiles, raise_for_status\n\nfrom urllib.parse import quote, urlencode, urljoin\n\nfrom django.utils.translation import gettext_lazy as _\nimport requests\n\naim_inputs = {\n    'fields': [\n        {\n            'id': 'url',\n            'label': _('CyberArk CCP URL'),\n            'type': 'string',\n            'format': 'url',\n        },\n        {\n            'id': 'webservice_id',\n            'label': _('Web Service ID'),\n            'type': 'string',\n            'help_text': _('The CCP Web Service ID. Leave blank to default to AIMWebService.'),\n        },\n        {\n            'id': 'app_id',\n            'label': _('Application ID'),\n            'type': 'string',\n            'secret': True,\n        },\n        {\n            'id': 'client_key',\n            'label': _('Client Key'),\n            'type': 'string',\n            'secret': True,\n            'multiline': True,\n        },\n        {\n            'id': 'client_cert',\n            'label': _('Client Certificate'),\n            'type': 'string',\n            'secret': True,\n            'multiline': True,\n        },\n        {\n            'id': 'verify',\n            'label': _('Verify SSL Certificates'),\n            'type': 'boolean',\n            'default': True,\n        },\n    ],\n    'metadata': [\n        {\n            'id': 'object_query',\n            'label': _('Object Query'),\n            'type': 'string',\n            'help_text': _('Lookup query for the object. Ex: Safe=TestSafe;Object=testAccountName123'),\n        },\n        {'id': 'object_query_format', 'label': _('Object Query Format'), 'type': 'string', 'default': 'Exact', 'choices': ['Exact', 'Regexp']},\n        {\n            'id': 'object_property',\n            'label': _('Object Property'),\n            'type': 'string',\n            'help_text': _('The property of the object to return. Available properties: Username, Password and Address.'),\n        },\n        {\n            'id': 'reason',\n            'label': _('Reason'),\n            'type': 'string',\n            'help_text': _('Object request reason. This is only needed if it is required by the object\\'s policy.'),\n        },\n    ],\n    'required': ['url', 'app_id', 'object_query'],\n}\n\n\ndef aim_backend(**kwargs):\n    url = kwargs['url']\n    client_cert = kwargs.get('client_cert', None)\n    client_key = kwargs.get('client_key', None)\n    verify = kwargs['verify']\n    webservice_id = kwargs.get('webservice_id', '')\n    app_id = kwargs['app_id']\n    object_query = kwargs['object_query']\n    object_query_format = kwargs['object_query_format']\n    object_property = kwargs.get('object_property', '')\n    reason = kwargs.get('reason', None)\n    if webservice_id == '':\n        webservice_id = 'AIMWebService'\n\n    query_params = {\n        'AppId': app_id,\n        'Query': object_query,\n        'QueryFormat': object_query_format,\n    }\n    if reason:\n        query_params['reason'] = reason\n\n    request_qs = '?' + urlencode(query_params, quote_via=quote)\n    request_url = urljoin(url, '/'.join([webservice_id, 'api', 'Accounts']))\n\n    with CertFiles(client_cert, client_key) as cert:\n        res = requests.get(\n            request_url + request_qs,\n            timeout=30,\n            cert=cert,\n            verify=verify,\n            allow_redirects=False,\n        )\n    raise_for_status(res)\n    # CCP returns the property name capitalized, username is camel case\n    # so we need to handle that case\n    if object_property == '':\n        object_property = 'Content'\n    elif object_property.lower() == 'username':\n        object_property = 'UserName'\n    elif object_property.lower() == 'password':\n        object_property = 'Content'\n    elif object_property.lower() == 'address':\n        object_property = 'Address'\n    elif object_property not in res:\n        raise KeyError('Property {} not found in object, available properties: Username, Password and Address'.format(object_property))\n    else:\n        object_property = object_property.capitalize()\n\n    return res.json()[object_property]\n\n\naim_plugin = CredentialPlugin('CyberArk Central Credential Provider Lookup', inputs=aim_inputs, backend=aim_backend)\n", "path": "awx/main/credential_plugins/aim.py"}]}