C# Class VaultSharp.VaultClientFactory

Represents a set of methods for creating instances of the IVaultClient interface implementations.
Afficher le fichier Open project: rajanadar/VaultSharp

Méthodes publiques

Méthode Description
CreateVaultClient ( Uri vaultServerUriWithPort, IAuthenticationInfo authenticationInfo, bool continueAsyncTasksOnCapturedContext = false, System.TimeSpan serviceTimeout = null, Action postHttpClientInitializeAction = null ) : IVaultClient

Creates an instance of the vault client, with the provided IAuthenticationInfo used to authenticate and authorize the user. This is the typical client you would need for your consuming applications.

If you need an instance of an administrative/root user based IVaultClient, pass a IAuthenticationInfo with a root policy mapping. If you need an instance of an unauthenticated IVaultClient, pass a null value for IAuthenticationInfo. An unauthenticated client can do very few operations. e.g. Check seal status, initialization status etc.

var vaultClient = VaultClientFactory.CreateVaultClient(new Uri("http://127.0.0.1:8200", new GitHubAuthenticationInfo(personalAccessToken: "YOUR_TOKEN"));

var administrativeVaultClient = VaultClientFactory.CreateVaultClient(new Uri("http://127.0.0.1:8200", new TokenAuthenticationInfo(token: "ROOT_POLICY_TOKEN"));

var unauthenticatedVaultClient = VaultClientFactory.CreateVaultClient(new Uri("http://127.0.0.1:8200", authenticationInfo: null));

Method Details

CreateVaultClient() public static méthode

Creates an instance of the vault client, with the provided IAuthenticationInfo used to authenticate and authorize the user. This is the typical client you would need for your consuming applications.

If you need an instance of an administrative/root user based IVaultClient, pass a IAuthenticationInfo with a root policy mapping. If you need an instance of an unauthenticated IVaultClient, pass a null value for IAuthenticationInfo. An unauthenticated client can do very few operations. e.g. Check seal status, initialization status etc.

var vaultClient = VaultClientFactory.CreateVaultClient(new Uri("http://127.0.0.1:8200", new GitHubAuthenticationInfo(personalAccessToken: "YOUR_TOKEN"));

var administrativeVaultClient = VaultClientFactory.CreateVaultClient(new Uri("http://127.0.0.1:8200", new TokenAuthenticationInfo(token: "ROOT_POLICY_TOKEN"));

var unauthenticatedVaultClient = VaultClientFactory.CreateVaultClient(new Uri("http://127.0.0.1:8200", authenticationInfo: null));

public static CreateVaultClient ( Uri vaultServerUriWithPort, IAuthenticationInfo authenticationInfo, bool continueAsyncTasksOnCapturedContext = false, System.TimeSpan serviceTimeout = null, Action postHttpClientInitializeAction = null ) : IVaultClient
vaultServerUriWithPort System.Uri [required] /// The vault server URI with port.
authenticationInfo IAuthenticationInfo [optional] /// The authentication information. e.g. GitHub, AppId, LDAP etc.
continueAsyncTasksOnCapturedContext bool [optional] /// if set to true [continue asynchronous tasks on captured context].
serviceTimeout System.TimeSpan [optional] /// The timeout value for the Vault Service calls. Do not specify a value, if you want to go with the default timeout values.
postHttpClientInitializeAction Action [optional] /// A post-processing delegate on the instance used by the library. /// This can be used to setup any custom message handlers, proxy settings etc. /// Please note that the delegate will get an instance of that is initialized with the address /// and timeout settings. ///
Résultat IVaultClient