One Identity Safeguard Web API .NET SDK
$ dotnet add package OneIdentity.SafeguardDotNetOne Identity Safeguard Web API .NET SDK
SafeguardDotNet provides a comprehensive .NET SDK for interacting with the One Identity Safeguard for Privileged Passwords API. This library simplifies authentication, API calls, and event handling, allowing you to integrate Safeguard functionality into your .NET applications with minimal code.
Multiple Authentication Methods
Full API Coverage
InvokeMethod()A2A (Application-to-Application) Support
Real-Time Event Notifications
Production-Ready Features
SafeguardDotNetExceptiondotnet add package OneIdentity.SafeguardDotNet
using OneIdentity.SafeguardDotNet;
using System.Security;
// Connect with username/password
SecureString password = GetPasswordSecurely();
var connection = Safeguard.Connect("safeguard.company.com", "local", "Admin", password);
// Call the API
string userData = connection.InvokeMethod(Service.Core, Method.Get, "Me");
Console.WriteLine(userData);
// Using certificate thumbprint from store
var connection = Safeguard.Connect("safeguard.company.com", "756766BB590D7FA9CA9E1971A4AE41BB9CEC82F1");
// Using PFX file
SecureString certPassword = GetPasswordSecurely();
var connection = Safeguard.Connect("safeguard.company.com", @"C:\certs\client.pfx", certPassword);
// Get A2A context with certificate
var a2aContext = Safeguard.A2A.GetContext("safeguard.company.com", @"C:\certs\a2a.pfx", certPassword, apiKey);
// Retrieve password
var password = a2aContext.RetrievePassword();
// Create persistent event listener (auto-reconnects)
var listener = connection.GetPersistentEventListener();
listener.RegisterEventHandler("AssetAccountPasswordUpdated", (eventName, eventBody) => {
Console.WriteLine($"Password changed: {eventBody}");
});
listener.Start();
SafeguardDotNet defaults to the v4 API. To use v3:
var connection = Safeguard.Connect("safeguard.company.com", "local", "Admin", password, apiVersion: 3);
Safeguard 7.X+ hosts both v3 and v4 APIs simultaneously.
This project is supported through:
Licensed under Apache 2.0
Copyright (c) 2026 One Identity LLC. All rights reserved.