Created
January 17, 2020 16:17
-
-
Save infamousjoeg/86040b4879d9e796871646788964d6ab to your computer and use it in GitHub Desktop.
CyberArk AAM Credential Provider - Using CLIPasswordSDK.exe in .NET Core
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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