Add BeyondTrust plugin - #10
Conversation
cosminvlad
left a comment
There was a problem hiding this comment.
Let's also remove the .DS_Store files.
| { | ||
| public class BeyondTrustVaultClientFactory | ||
| { | ||
| private static BeyondTrustVaultClient client; |
There was a problem hiding this comment.
You can't cache a single static client for the lifetime of the app. That means you can only configure a single credential store of this type per application (not per tenant), which is not a restriction we currently have. Also, caching a static instance means changing the configuration will have no effect until you restart the app.
See the Hashicorp implementation, which does caching of client per context: https://github.com/UiPath/Orchestrator-CredentialStorePlugins/blob/master/src/SecureStore.HashicorpVault/HashicorpVaultClientFactory.cs#L25
|
|
||
| # Backup folder for Package Reference Convert tool in Visual Studio 2017 | ||
| MigrationBackup/ | ||
| src/SecureStore.BeyondTrust/.DS_Store |
There was a problem hiding this comment.
This would ignore files with this name from all folders
| src/SecureStore.BeyondTrust/.DS_Store | |
| .DS_Store |
| var config = JsonConvert.DeserializeObject<Dictionary<string, object>>(context); | ||
| var client = BeyondTrustVaultClientFactory.GetClient(context); | ||
| var semaphore = SemaphoreFactory.SemaphoreSlim; | ||
| await semaphore.WaitAsync(); |
There was a problem hiding this comment.
You should use a timeout, so as not to wait forever in case there is a block somewhere.
| await semaphore.WaitAsync(); | |
| await semaphore.WaitAsync(TimeSpan.FromSeconds(60)); |
| if (client == null) | ||
| { | ||
| var config = JsonConvert.DeserializeObject<Dictionary<string, object>>(context); | ||
| client = new BeyondTrustVaultClient(config); | ||
| } |
There was a problem hiding this comment.
This does not guarantee a single client is ever created. If two calls to BeyondTrustSingleSystemSecureStore.ValidateContextAsync are made at the same time, you can reach the null check on two threads at the same time and they both proceed to create a client and then return it.
|
|
||
| namespace UiPath.Orchestrator.Extensions.SecureStores.BeyondTrust | ||
| { | ||
| public class SemaphoreFactory |
There was a problem hiding this comment.
Nit: This is not a factory. Call it SemaphoreHolder
No description provided.