My changes.

This commit is contained in:
Adam C. Migus 2021-06-28 18:41:04 +00:00 committed by Adam Migus
parent 0cc6bf9b60
commit b0b295ba1e

View File

@ -8,19 +8,19 @@ tss_inputs = {
{
'id': 'server_url',
'label': _('Secret Server URL'),
'help_text': _(''),
'help_text': _('The Base URL of Secret Server e.g. https://myserver/SecretServer or https://mytenant.secretservercloud.com'),
'type': 'string',
},
{
'id': 'username',
'label': _('Username'),
'help_text': _(''),
'help_text': _('The (Application) user username'),
'type': 'string',
},
{
'id': 'password',
'label': _('Password'),
'help_text': _(''),
'help_text': _('The corresponding password'),
'type': 'string',
'secret': True,
},
@ -29,17 +29,17 @@ tss_inputs = {
{
'id': 'secret_id',
'label': _('Secret ID'),
'help_text': _(''),
'help_text': _('The integer ID of the secret'),
'type': 'int',
},
],
'required': ['server_url', 'username', 'password', 'secret_id'],
}
def tss_backend(**kwargs):
authorizer = PasswordGrantAuthorizer(kwargs['server_url'], kwargs['username'], kwargs['password'])
return SecretServer(authorizer).get_secret(kwargs['secret_id'])
tss_plugin = CredentialPlugin('Thycotic Secret Server', inputs=tss_inputs, backend=tss_backend)
tss_plugin = CredentialPlugin(
'Thycotic Secret Server',
tss_inputs,
lambda **kwargs: SecretServer(
PasswordGrantAuthorizer(**{k: v for (k, v) in kwargs.items() if k in [field['id'] for field in tss_inputs['fields']]})
).get_secret(kwargs['secret_id']),
)