diff --git a/src/awx_plugins/credentials/plugins.py b/src/awx_plugins/credentials/plugins.py index 8c1a218243..b0c4cecc6b 100644 --- a/src/awx_plugins/credentials/plugins.py +++ b/src/awx_plugins/credentials/plugins.py @@ -586,22 +586,59 @@ inputs={ 'fields': [ { - 'id': 'username', 'label': gettext_noop('Username'), 'type': 'string', + 'id': 'username', + 'label': gettext_noop('Username'), + 'type': 'string', + 'help_text': gettext_noop( + 'Required for basic authentication. ' + 'May be blank if using client_id and client_secret', + ), }, { - 'id': 'password', 'label': gettext_noop('Password'), 'type': 'string', 'secret': True, + 'id': 'password', + 'label': gettext_noop('Password'), + 'type': 'string', + 'secret': True, + 'help_text': gettext_noop( + 'Required for basic authentication. ' + 'May be blank if using client_id and client_secret', + ), + }, + { + 'id': 'client_id', + 'label': gettext_noop('Client ID'), + 'type': 'string', + 'help_text': gettext_noop( + 'Required for service account authentication. ' + 'May be blank if using username and password', + ), + }, + { + 'id': 'client_secret', + 'label': gettext_noop('Client Secret'), + 'type': 'string', + 'secret': True, + 'help_text': gettext_noop( + 'Required for service account authentication. ' + 'May be blank if using username and password', + ), }, ], - 'required': ['username', 'password'], + 'required': [], }, injectors={ 'extra_vars': { 'scm_username': '{{username}}', 'scm_password': '{{password}}', + 'client_id': '{{client_id}}', + 'client_secret': '{{client_secret}}', + 'authentication': '{% if client_id %}service_account{% else %}basic{% endif %}', }, 'env': { 'INSIGHTS_USER': '{{username}}', 'INSIGHTS_PASSWORD': '{{password}}', + 'INSIGHTS_CLIENT_ID': '{{client_id}}', + 'INSIGHTS_CLIENT_SECRET': '{{client_secret}}', }, }, )