mirror of
https://github.com/ansible/awx.git
synced 2026-01-23 07:28:02 -03:30
Extract the field from the secret.
This commit is contained in:
parent
9dc84d69d5
commit
77ab35e7a8
@ -1,7 +1,7 @@
|
||||
from .plugin import CredentialPlugin
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from thycotic.secrets.server import SecretServer, PasswordGrantAuthorizer
|
||||
from thycotic.secrets.server import PasswordGrantAuthorizer, SecretServer, ServerSecret
|
||||
|
||||
tss_inputs = {
|
||||
'fields': [
|
||||
@ -32,14 +32,22 @@ tss_inputs = {
|
||||
'help_text': _('The integer ID of the secret'),
|
||||
'type': 'string',
|
||||
},
|
||||
{
|
||||
'id': 'secret_field',
|
||||
'label': _('Secret Field'),
|
||||
'help_text': _('The field to extract from the secret'),
|
||||
'type': 'string',
|
||||
},
|
||||
],
|
||||
'required': ['server_url', 'username', 'password', 'secret_id'],
|
||||
'required': ['server_url', 'username', 'password', 'secret_id', 'secret_field'],
|
||||
}
|
||||
|
||||
tss_plugin = CredentialPlugin(
|
||||
'Thycotic Secret Server',
|
||||
tss_inputs,
|
||||
lambda **kwargs: SecretServer(kwargs['server_url'], PasswordGrantAuthorizer(kwargs['server_url'], kwargs['username'], kwargs['password'])).get_secret(
|
||||
kwargs['secret_id']
|
||||
),
|
||||
lambda **kwargs: ServerSecret(
|
||||
**SecretServer(kwargs['server_url'], PasswordGrantAuthorizer(kwargs['server_url'], kwargs['username'], kwargs['password'])).get_secret(
|
||||
kwargs['secret_id']
|
||||
)
|
||||
).fields[kwargs['secret_field']],
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user