Skip to content

Instantly share code, notes, and snippets.

@infamousjoeg
Created January 17, 2020 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infamousjoeg/86040b4879d9e796871646788964d6ab to your computer and use it in GitHub Desktop.
Save infamousjoeg/86040b4879d9e796871646788964d6ab to your computer and use it in GitHub Desktop.
CyberArk AAM Credential Provider - Using CLIPasswordSDK.exe in .NET Core
public class ValuesController : ControllerBase
{
public ActionResult<string> Get()
{
using (var process = new Process())
{
process.StartInfo.FileName = @"C:\Program Files (x86)\CyberArk\ApplicationPasswordSdk\CLIPasswordSDK.exe";
process.StartInfo.Arguments = @"GetPassword /p AppDescs.AppID=""AppId"" /p Query=""Safe=SafeName;Username=Username"" /p RequiredProps=* /o Address,Username";
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.OutputDataReceived += (sender, data) => Console.WriteLine(data.Data);
process.ErrorDataReceived += (sender, data) => Console.WriteLine(data.Data);
Console.WriteLine("starting");
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
var exited = process.WaitForExit(1000 * 10); // (optional) wait up to 10 seconds
Console.WriteLine($"exit {exited}");
}
return "value";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment