diff --git a/TestClient.go b/TestClient.go index ee98443..0cbd03e 100644 --- a/TestClient.go +++ b/TestClient.go @@ -7,6 +7,7 @@ import ( "github.com/BeyondTrust/go-client-library-passwordsafe/api/authentication" logging "github.com/BeyondTrust/go-client-library-passwordsafe/api/logging" managed_accounts "github.com/BeyondTrust/go-client-library-passwordsafe/api/managed_account" + "github.com/BeyondTrust/go-client-library-passwordsafe/api/secrets" "github.com/BeyondTrust/go-client-library-passwordsafe/api/utils" //"os" @@ -25,9 +26,9 @@ func main() { // create a zap logger wrapper zapLogger := logging.NewZapLogger(logger) - apiUrl := "https://jury2310.ps-dev.beyondtrustcloud.com:443/BeyondTrust/api/public/v3/" - clientId := "6138d050-e266-4b05-9ced-35e7dd5093ae" - clientSecret := "71svdPLh2AR97sPs5gfPjGjpqSUxZTKSPmEvvbMx89o=" + apiUrl := "https://example.com:443/BeyondTrust/api/public/v3/" + clientId := "" + clientSecret := "" separator := "/" certificate := "" certificateKey := "" @@ -78,29 +79,26 @@ func main() { return } - /* - // instantiating secret obj - secretObj, _ := secrets.NewSecretObj(*authenticate, zapLogger, maxFileSecretSizeBytes) + // instantiating secret obj + secretObj, _ := secrets.NewSecretObj(*authenticate, zapLogger, maxFileSecretSizeBytes) - secretPaths := []string{"fake/Client", "fake/test_file_1"} + secretPaths := []string{"fake/Client", "fake/test_file_1"} - gotSecrets, _ := secretObj.GetSecrets(secretPaths, separator) + gotSecrets, _ := secretObj.GetSecrets(secretPaths, separator) - // WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes: - zapLogger.Warn(fmt.Sprintf("%v", gotSecrets)) - - // getting single secret - gotSecret, _ := secretObj.GetSecret("fake/Test1", separator) + // WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes: + zapLogger.Warn(fmt.Sprintf("%v", gotSecrets)) - // WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes: - zapLogger.Warn(fmt.Sprintf("Secret Test: %v", gotSecret)) + // getting single secret + gotSecret, _ := secretObj.GetSecret("fake/Test1", separator) - */ + // WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes: + zapLogger.Warn(fmt.Sprintf("Secret Test: %v", gotSecret)) // instantiating managed account obj manageAccountObj, _ := managed_accounts.NewManagedAccountObj(*authenticate, zapLogger) - newSecretPaths := []string{"system01/managed_account01", "system01/managed_account01"} + newSecretPaths := []string{"fake/account01", "fake/account01"} //managedAccountList := strings.Split(paths, ",") gotManagedAccounts, _ := manageAccountObj.GetSecrets(newSecretPaths, separator) @@ -109,7 +107,7 @@ func main() { zapLogger.Warn(fmt.Sprintf("%v", gotManagedAccounts)) // getting single managed account - gotManagedAccount, _ := manageAccountObj.GetSecret("system01/managed_account01", separator) + gotManagedAccount, _ := manageAccountObj.GetSecret("fake/account04", separator) // WARNING: Do not log secrets in production code, the following log statement logs test secrets for testing purposes: zapLogger.Warn(fmt.Sprintf("%v", gotManagedAccount))