Skip to content

Commit

Permalink
Merge pull request #12627 from vician/tss-domain
Browse files Browse the repository at this point in the history
Added domain entry and authorizer for TSS
  • Loading branch information
TheRealHaoLiu authored Apr 12, 2023
2 parents e42461d + 6d2c10a commit 8a1cdf8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions awx/main/credential_plugins/tss.py
Original file line number Diff line number Diff line change
@@ -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': [
Expand All @@ -17,6 +17,12 @@
'help_text': _('The (Application) user username'),
'type': 'string',
},
{
'id': 'domain',
'label': _('Domain'),
'help_text': _('The (Application) user domain'),
'type': 'string',
},
{
'id': 'password',
'label': _('Password'),
Expand Down Expand Up @@ -44,7 +50,10 @@


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)
Expand Down

0 comments on commit 8a1cdf8

Please sign in to comment.