public static IVaultService AuthenticateUsingToken(this DefaultVaultService vaultService, string token)
        {
            var auth = new TokenAuthentication(vaultService, token);

            vaultService.AuthenticateAsync(auth).ConfigureAwait(false).GetAwaiter().GetResult();
            return(vaultService);
        }
        public static IVaultService AuthenticateUsingUserPass(this DefaultVaultService vaultService, string userName, string password)
        {
            var auth = new UserPassAuthentication(vaultService);

            auth.Credentials(userName, password);
            vaultService.AuthenticateAsync(auth).ConfigureAwait(false).GetAwaiter().GetResult();
            return(vaultService);
        }
예제 #3
0
 /// <summary>
 /// Sets the vault authentication token.
 /// </summary>
 /// <param name="vaultService">The vault service instance.</param>
 /// <param name="vaultToken">The vault token.</param>
 public TokenAuthentication(DefaultVaultService vaultService, string vaultToken)
 {
     VaultService = vaultService ?? throw new ArgumentNullException(nameof(vaultService));
     m_vaultToken = vaultToken.ToSecureString();
 }