From 6d2c10ad02db12539e52219f4836e0c33dc47616 Mon Sep 17 00:00:00 2001 From: Martin Vician Date: Fri, 5 Aug 2022 14:13:12 +0100 Subject: [PATCH] Added domain item and authorizer for TSS --- awx/main/credential_plugins/tss.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/awx/main/credential_plugins/tss.py b/awx/main/credential_plugins/tss.py index 1803400e2f..44a35b7dbd 100644 --- a/awx/main/credential_plugins/tss.py +++ b/awx/main/credential_plugins/tss.py @@ -1,7 +1,7 @@ from .plugin import CredentialPlugin from django.utils.translation import gettext_lazy as _ -from thycotic.secrets.server import PasswordGrantAuthorizer, SecretServer, ServerSecret +from thycotic.secrets.server import DomainPasswordGrantAuthorizer, PasswordGrantAuthorizer, SecretServer, ServerSecret tss_inputs = { 'fields': [ @@ -17,6 +17,12 @@ tss_inputs = { 'help_text': _('The (Application) user username'), 'type': 'string', }, + { + 'id': 'domain', + 'label': _('Domain'), + 'help_text': _('The (Application) user domain'), + 'type': 'string', + }, { 'id': 'password', 'label': _('Password'), @@ -44,7 +50,10 @@ tss_inputs = { def tss_backend(**kwargs): - authorizer = PasswordGrantAuthorizer(kwargs['server_url'], kwargs['username'], kwargs['password']) + if 'domain' in kwargs: + authorizer = DomainPasswordGrantAuthorizer(kwargs['server_url'], kwargs['username'], kwargs['password'], kwargs['domain']) + else: + authorizer = PasswordGrantAuthorizer(kwargs['server_url'], kwargs['username'], kwargs['password']) secret_server = SecretServer(kwargs['server_url'], authorizer) secret_dict = secret_server.get_secret(kwargs['secret_id']) secret = ServerSecret(**secret_dict)