From 0991cf74ef0374bbb9f80787d21ea0ed22cd10b4 Mon Sep 17 00:00:00 2001 From: "massimo.antonello" Date: Fri, 17 Oct 2025 14:53:01 +0200 Subject: [PATCH] Secret Engine Property --- ExternalConnectors/VO/VaultOpenbao.cs | 72 ++++--- .../Xml/XmlConnectionNodeSerializer28.cs | 5 +- .../Xml/XmlConnectionsDeserializer.cs | 7 +- .../Xml/XmlRootNodeSerializer.cs | 2 +- .../Connection/AbstractConnectionRecord.cs | 33 +-- mRemoteNG/Connection/Protocol/PuttyBase.cs | 2 +- .../Connection/Protocol/RDP/RdpProtocol.cs | 8 +- .../Connection/VaultOpenbaoSecretEngine.cs | 20 ++ mRemoteNG/Language/Language.Designer.cs | 117 +++++++---- mRemoteNG/Language/Language.cs-CZ.resx | 31 ++- mRemoteNG/Language/Language.de.resx | 23 ++- mRemoteNG/Language/Language.el.resx | 23 ++- mRemoteNG/Language/Language.es-AR.resx | 23 ++- mRemoteNG/Language/Language.es.resx | 23 ++- mRemoteNG/Language/Language.fi-FI.resx | 23 ++- mRemoteNG/Language/Language.fr.resx | 23 ++- mRemoteNG/Language/Language.hu.resx | 23 ++- mRemoteNG/Language/Language.it.resx | 23 ++- mRemoteNG/Language/Language.ja-JP.resx | 23 ++- mRemoteNG/Language/Language.ko-KR.resx | 23 ++- mRemoteNG/Language/Language.lt.resx | 23 ++- mRemoteNG/Language/Language.nb-NO.resx | 23 ++- mRemoteNG/Language/Language.nl.resx | 23 ++- mRemoteNG/Language/Language.pl.resx | 23 ++- mRemoteNG/Language/Language.pt-BR.resx | 23 ++- mRemoteNG/Language/Language.pt.resx | 23 ++- mRemoteNG/Language/Language.resx | 31 ++- mRemoteNG/Language/Language.ru.resx | 23 ++- mRemoteNG/Language/Language.sv-SE.resx | 23 ++- mRemoteNG/Language/Language.ta.resx | 23 ++- mRemoteNG/Language/Language.tr-TR.resx | 23 ++- mRemoteNG/Language/Language.uk.resx | 23 ++- mRemoteNG/Language/Language.zh-CN.resx | 23 ++- mRemoteNG/Language/Language.zh-TW.resx | 23 ++- mRemoteNG/Tree/Root/RootNodeInfo.cs | 24 +-- .../ConnectionInfoPropertyGrid.cs | 189 ++++++------------ 36 files changed, 741 insertions(+), 329 deletions(-) create mode 100644 mRemoteNG/Connection/VaultOpenbaoSecretEngine.cs diff --git a/ExternalConnectors/VO/VaultOpenbao.cs b/ExternalConnectors/VO/VaultOpenbao.cs index 249f3b8a..c41d9942 100644 --- a/ExternalConnectors/VO/VaultOpenbao.cs +++ b/ExternalConnectors/VO/VaultOpenbao.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json.Linq; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,6 +7,7 @@ using System.Threading.Tasks; using VaultSharp; using VaultSharp.V1.AuthMethods; using VaultSharp.V1.AuthMethods.Token; +using VaultSharp.V1.SecretsEngines; namespace ExternalConnectors.VO { public class VaultOpenbaoException(string message, string arguments) : Exception(message) { @@ -13,41 +15,57 @@ namespace ExternalConnectors.VO { } public static class VaultOpenbao { - public static void ReadPasswordSSH(string url, string token, string mount, string role, string address, string username, out string password) { + private static VaultClient GetClient(string url, string token) { IAuthMethodInfo authMethod = new TokenAuthMethodInfo(token); var vaultClientSettings = new VaultClientSettings(url, authMethod); - VaultClient vaultClient = new(vaultClientSettings); - var mountType = vaultClient.V1.System.GetSecretBackendAsync(mount).Result.Data.Type; - switch (mountType.Type) { - case "ssh": - var ssh = vaultClient.V1.Secrets.SSH.GetCredentialsAsync(role, address, username, mount).Result; - password = ssh.Data.Key; + return new(vaultClientSettings); + } + private static void TestMountType(VaultClient vaultClient, string mount, int VaultOpenbaoSecretEngine) { + switch (vaultClient.V1.System.GetSecretBackendAsync(mount).Result.Data.Type.Type) { + case "kv" when VaultOpenbaoSecretEngine != 0: + throw new VaultOpenbaoException($"Backend of type kv does not match expected type {VaultOpenbaoSecretEngine}", null); + case "ldap" when VaultOpenbaoSecretEngine != 1 && VaultOpenbaoSecretEngine != 2: + throw new VaultOpenbaoException($"Backend of type ldap does not match expected type {VaultOpenbaoSecretEngine}", null); + } + } + public static void ReadPasswordSSH(string url, string token, int secretEngine, string mount, string role, string username, out string password) { + VaultClient vaultClient = GetClient(url, token); + TestMountType(vaultClient, mount, secretEngine); + switch (secretEngine) { + case 0: + var kv = vaultClient.V1.Secrets.KeyValue.V2.ReadSecretAsync(role, mountPoint: mount).Result; + password = kv.Data.Data[username].ToString(); return; + //case "ssh": // TODO: does not work with Keyboard-Interactive yet + // var ssh = vaultClient.V1.Secrets.SSH.GetCredentialsAsync(role, address, username, mount).Result; + // password = ssh.Data.Key; + // return; default: - throw new VaultOpenbaoException($"Backend of type {mountType.Type} is not supported", null); + throw new VaultOpenbaoException($"Backend of type {secretEngine} is not supported", null); } } - public static void ReadPasswordRDP(string url, string token, string mount, string role, out string username, out string password) { - IAuthMethodInfo authMethod = new TokenAuthMethodInfo(token); - var vaultClientSettings = new VaultClientSettings(url, authMethod); - VaultClient vaultClient = new(vaultClientSettings); - var mountType = vaultClient.V1.System.GetSecretBackendAsync(mount).Result.Data.Type; - switch (mountType.Type) { - case "ldap": - try { // don't care if dynamic or static. try both - var secret = vaultClient.V1.Secrets.OpenLDAP.GetDynamicCredentialsAsync(role, mount).Result; - username = secret.Data.Username; - password = secret.Data.Password; - } catch (Exception) { - var secret = vaultClient.V1.Secrets.OpenLDAP.GetStaticCredentialsAsync(role, mount).Result; - username = secret.Data.Username; - password = secret.Data.Password; - } + public static void ReadPasswordRDP(string url, string token, int secretEngine, string mount, string role, ref string username, out string password) { + VaultClient vaultClient = GetClient(url, token); + TestMountType(vaultClient, mount, secretEngine); + switch (secretEngine) { + case 0: + var kv = vaultClient.V1.Secrets.KeyValue.V2.ReadSecretAsync(role, mountPoint: mount).Result; + password = kv.Data.Data[username].ToString(); return; - + case 1: + var ldapd = vaultClient.V1.Secrets.OpenLDAP.GetDynamicCredentialsAsync(role, mount).Result; + username = ldapd.Data.Username; + password = ldapd.Data.Password; + return; + case 2: + var ldaps = vaultClient.V1.Secrets.OpenLDAP.GetStaticCredentialsAsync(role, mount).Result; + username = ldaps.Data.Username; + password = ldaps.Data.Password; + return; + default: - throw new VaultOpenbaoException($"Backend of type {mountType.Type} is not supported", null); + throw new VaultOpenbaoException($"Backend of type {secretEngine} is not supported", null); } } diff --git a/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer28.cs b/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer28.cs index 00020f07..0e8743f3 100644 --- a/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer28.cs +++ b/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionNodeSerializer28.cs @@ -154,8 +154,9 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml element.Add(new XAttribute("ExternalAddressProvider", connectionInfo.ExternalAddressProvider)); // Vault/OpenBao specific - element.Add(new XAttribute("VaultMount", connectionInfo.VaultMount ?? string.Empty)); - element.Add(new XAttribute("VaultRole", connectionInfo.VaultRole ?? string.Empty)); + element.Add(new XAttribute("VaultOpenbaoMount", connectionInfo.VaultOpenbaoMount ?? string.Empty)); + element.Add(new XAttribute("VaultOpenbaoRole", connectionInfo.VaultOpenbaoRole ?? string.Empty)); + element.Add(new XAttribute("VaultOpenbaoSecretEngine", connectionInfo.VaultOpenbaoSecretEngine)); } private void SetInheritanceAttributes(XContainer element, IInheritable connectionInfo) diff --git a/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDeserializer.cs b/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDeserializer.cs index 1fb05a36..97d15dde 100644 --- a/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDeserializer.cs +++ b/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlConnectionsDeserializer.cs @@ -120,7 +120,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml private void InitializeRootNode(XmlElement connectionsRootElement) { _rootNodeInfo.Name = connectionsRootElement?.Attributes["Name"]?.Value.Trim(); - _rootNodeInfo.OpenbaoVaultUrl = connectionsRootElement?.Attributes["OpenbaoVaultUrl"]?.Value.Trim(); + _rootNodeInfo.VaultOpenbaoUrl = connectionsRootElement?.Attributes["VaultOpenbaoUrl"]?.Value.Trim(); } private void CreateDecryptor(RootNodeInfo rootNodeInfo, XmlElement connectionsRootElement = null) @@ -517,8 +517,9 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml connectionInfo.UserViaAPI = xmlnode.GetAttributeAsString("UserViaAPI"); connectionInfo.Inheritance.UserViaAPI = xmlnode.GetAttributeAsBool("InheritUserViaAPI"); connectionInfo.ExternalAddressProvider = xmlnode.GetAttributeAsEnum("ExternalAddressProvider", ExternalAddressProvider.None); - connectionInfo.VaultMount = xmlnode.GetAttributeAsString("VaultMount"); - connectionInfo.VaultRole = xmlnode.GetAttributeAsString("VaultRole"); + connectionInfo.VaultOpenbaoMount = xmlnode.GetAttributeAsString("VaultOpenbaoMount"); + connectionInfo.VaultOpenbaoRole = xmlnode.GetAttributeAsString("VaultOpenbaoRole"); + connectionInfo.VaultOpenbaoSecretEngine = xmlnode.GetAttributeAsEnum("VaultOpenbaoSecretEngine", VaultOpenbaoSecretEngine.Kv); connectionInfo.EC2InstanceId = xmlnode.GetAttributeAsString("EC2InstanceId"); connectionInfo.EC2Region = xmlnode.GetAttributeAsString("EC2Region"); connectionInfo.UseRestrictedAdmin = xmlnode.GetAttributeAsBool("UseRestrictedAdmin"); diff --git a/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs b/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs index b102f662..8b8f3cc7 100644 --- a/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs +++ b/mRemoteNG/Config/Serializers/ConnectionSerializers/Xml/XmlRootNodeSerializer.cs @@ -15,7 +15,7 @@ namespace mRemoteNG.Config.Serializers.ConnectionSerializers.Xml XElement element = new(xmlNamespace + "Connections"); element.Add(new XAttribute(XNamespace.Xmlns + "mrng", xmlNamespace)); element.Add(new XAttribute(XName.Get("Name"), rootNodeInfo.Name)); - element.Add(new XAttribute(XName.Get("OpenbaoVaultUrl"), rootNodeInfo.OpenbaoVaultUrl)); + element.Add(new XAttribute(XName.Get("VaultOpenbaoUrl"), rootNodeInfo.VaultOpenbaoUrl)); element.Add(new XAttribute(XName.Get("Export"), "false")); element.Add(new XAttribute(XName.Get("EncryptionEngine"), cryptographyProvider.CipherEngine)); element.Add(new XAttribute(XName.Get("BlockCipherMode"), cryptographyProvider.CipherMode)); diff --git a/mRemoteNG/Connection/AbstractConnectionRecord.cs b/mRemoteNG/Connection/AbstractConnectionRecord.cs index 890bc523..d0ddbc4b 100644 --- a/mRemoteNG/Connection/AbstractConnectionRecord.cs +++ b/mRemoteNG/Connection/AbstractConnectionRecord.cs @@ -37,6 +37,7 @@ namespace mRemoteNG.Connection private string _password = null; private string _vaultRole = null; private string _vaultMount = null; + private VaultOpenbaoSecretEngine _vaultSecretEngine = VaultOpenbaoSecretEngine.Kv; private string _domain = ""; private string _vmId = ""; private bool _useEnhancedMode; @@ -252,25 +253,33 @@ namespace mRemoteNG.Connection [LocalizedAttributes.LocalizedCategory(nameof(Language.Connection), 2), LocalizedAttributes.LocalizedDisplayName(nameof(Language.VaultOpenbaoMount)), LocalizedAttributes.LocalizedDescription(nameof(Language.VaultOpenbaoMountDescription)), - AttributeUsedInProtocol(ProtocolType.RDP, ProtocolType.VNC, ProtocolType.ARD, ProtocolType.SSH1, - ProtocolType.SSH2, ProtocolType.Telnet, ProtocolType.RAW, ProtocolType.HTTP, ProtocolType.HTTPS, - ProtocolType.IntApp)] - public virtual string VaultMount { - get => GetPropertyValue("VaultMount", _vaultMount); - set => SetField(ref _vaultMount, value, "VaultMount"); + AttributeUsedInProtocol(ProtocolType.RDP, ProtocolType.SSH1, ProtocolType.SSH2)] + public virtual string VaultOpenbaoMount { + get => GetPropertyValue("VaultOpenbaoMount", _vaultMount); + set => SetField(ref _vaultMount, value, "VaultOpenbaoMount"); } [LocalizedAttributes.LocalizedCategory(nameof(Language.Connection), 2), LocalizedAttributes.LocalizedDisplayName(nameof(Language.VaultOpenbaoRole)), LocalizedAttributes.LocalizedDescription(nameof(Language.VaultOpenbaoRoleDescription)), - AttributeUsedInProtocol(ProtocolType.RDP, ProtocolType.VNC, ProtocolType.ARD, ProtocolType.SSH1, - ProtocolType.SSH2, ProtocolType.Telnet, ProtocolType.RAW, ProtocolType.HTTP, ProtocolType.HTTPS, - ProtocolType.IntApp)] - public virtual string VaultRole { - get => GetPropertyValue("VaultRole", _vaultRole); - set => SetField(ref _vaultRole, value, "VaultRole"); + AttributeUsedInProtocol(ProtocolType.RDP, ProtocolType.SSH1, ProtocolType.SSH2)] + public virtual string VaultOpenbaoRole { + get => GetPropertyValue("VaultOpenbaoRole", _vaultRole); + set => SetField(ref _vaultRole, value, "VaultOpenbaoRole"); } + // external credential provider selector + [LocalizedAttributes.LocalizedCategory(nameof(Language.Connection), 2), + LocalizedAttributes.LocalizedDisplayName(nameof(Language.VaultOpenbaoSecretEngine)), + LocalizedAttributes.LocalizedDescription(nameof(Language.PropertyDescriptionVaultOpenbaoSecretEngine)), + TypeConverter(typeof(MiscTools.EnumTypeConverter)), + AttributeUsedInProtocol(ProtocolType.RDP, ProtocolType.SSH1, ProtocolType.SSH2)] + public VaultOpenbaoSecretEngine VaultOpenbaoSecretEngine { + get => GetPropertyValue("VaultOpenbaoSecretEngine", _vaultSecretEngine); + set => SetField(ref _vaultSecretEngine, value, "VaultOpenbaoSecretEngine"); + } + + [LocalizedAttributes.LocalizedCategory(nameof(Language.Connection), 2), LocalizedAttributes.LocalizedDisplayName(nameof(Language.Domain)), LocalizedAttributes.LocalizedDescription(nameof(Language.PropertyDescriptionDomain)), diff --git a/mRemoteNG/Connection/Protocol/PuttyBase.cs b/mRemoteNG/Connection/Protocol/PuttyBase.cs index 9a8b9d0a..b4a2dba6 100644 --- a/mRemoteNG/Connection/Protocol/PuttyBase.cs +++ b/mRemoteNG/Connection/Protocol/PuttyBase.cs @@ -168,7 +168,7 @@ namespace mRemoteNG.Connection.Protocol Event_ErrorOccured(this, "Secret Server Interface Error: No valid Openbao/Vault data found in root node.", 0); return false; } - ExternalConnectors.VO.VaultOpenbao.ReadPasswordSSH(rootNode.OpenbaoVaultUrl, rootNode.OpenbaoVaultToken, InterfaceControl.Info?.VaultMount ?? "", InterfaceControl.Info?.VaultRole ?? "", InterfaceControl.Info?.Hostname ?? "", InterfaceControl.Info?.Username ?? "root", out password); + ExternalConnectors.VO.VaultOpenbao.ReadPasswordSSH(rootNode.VaultOpenbaoUrl, rootNode.VaultOpenbaoToken, (int)InterfaceControl.Info?.VaultOpenbaoSecretEngine, InterfaceControl.Info?.VaultOpenbaoMount ?? "", InterfaceControl.Info?.VaultOpenbaoRole ?? "", InterfaceControl.Info?.Username ?? "root", out password); } catch (ExternalConnectors.VO.VaultOpenbaoException ex) { Event_ErrorOccured(this, "Secret Server Interface Error: " + ex.Message, 0); } diff --git a/mRemoteNG/Connection/Protocol/RDP/RdpProtocol.cs b/mRemoteNG/Connection/Protocol/RDP/RdpProtocol.cs index 78784476..a3dc8a96 100644 --- a/mRemoteNG/Connection/Protocol/RDP/RdpProtocol.cs +++ b/mRemoteNG/Connection/Protocol/RDP/RdpProtocol.cs @@ -488,7 +488,9 @@ namespace mRemoteNG.Connection.Protocol.RDP Event_ErrorOccured(this, "Secret Server Interface Error: No valid Openbao/Vault data found in root node.", 0); return; } - ExternalConnectors.VO.VaultOpenbao.ReadPasswordRDP(rootNode.OpenbaoVaultUrl, rootNode.OpenbaoVaultToken, connectionInfo.VaultMount, connectionInfo.VaultRole, out gwu, out gwp); + if (connectionInfo.VaultOpenbaoSecretEngine == VaultOpenbaoSecretEngine.Kv) + gwu = connectionInfo.RDGatewayUsername; + ExternalConnectors.VO.VaultOpenbao.ReadPasswordRDP(rootNode.VaultOpenbaoUrl, rootNode.VaultOpenbaoToken, (int)connectionInfo.VaultOpenbaoSecretEngine, connectionInfo.VaultOpenbaoMount, connectionInfo.VaultOpenbaoRole, ref gwu, out gwp); } catch (ExternalConnectors.VO.VaultOpenbaoException ex) { Event_ErrorOccured(this, "Secret Server Interface Error: " + ex.Message, 0); } @@ -612,7 +614,9 @@ namespace mRemoteNG.Connection.Protocol.RDP Event_ErrorOccured(this, "Secret Server Interface Error: No valid Openbao/Vault data found in root node.", 0); return; } - ExternalConnectors.VO.VaultOpenbao.ReadPasswordRDP(rootNode.OpenbaoVaultUrl, rootNode.OpenbaoVaultToken, connectionInfo?.VaultMount ?? "", connectionInfo?.VaultRole ?? "", out userName, out password); + if(connectionInfo.VaultOpenbaoSecretEngine == VaultOpenbaoSecretEngine.Kv) + userName = connectionInfo?.Username ?? ""; + ExternalConnectors.VO.VaultOpenbao.ReadPasswordRDP(rootNode.VaultOpenbaoUrl, rootNode.VaultOpenbaoToken, (int)connectionInfo.VaultOpenbaoSecretEngine, connectionInfo?.VaultOpenbaoMount ?? "", connectionInfo?.VaultOpenbaoRole ?? "", ref userName, out password); } catch (ExternalConnectors.VO.VaultOpenbaoException ex) { Event_ErrorOccured(this, "Secret Server Interface Error: " + ex.Message, 0); } diff --git a/mRemoteNG/Connection/VaultOpenbaoSecretEngine.cs b/mRemoteNG/Connection/VaultOpenbaoSecretEngine.cs new file mode 100644 index 00000000..507dcb06 --- /dev/null +++ b/mRemoteNG/Connection/VaultOpenbaoSecretEngine.cs @@ -0,0 +1,20 @@ +using mRemoteNG.Resources.Language; +using mRemoteNG.Tools; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace mRemoteNG.Connection { + public enum VaultOpenbaoSecretEngine { + [LocalizedAttributes.LocalizedDescription(nameof(Language.VaultOpenbaoSecretEngineKeyValue))] + Kv = 0, + + [LocalizedAttributes.LocalizedDescription(nameof(Language.VaultOpenbaoSecretEngineLDAPDynamic))] + LdapDynamic = 1, + + [LocalizedAttributes.LocalizedDescription(nameof(Language.VaultOpenbaoSecretEngineLDAPStatic))] + LdapStatic = 2, + } +} diff --git a/mRemoteNG/Language/Language.Designer.cs b/mRemoteNG/Language/Language.Designer.cs index d574b15c..fbcbaf71 100644 --- a/mRemoteNG/Language/Language.Designer.cs +++ b/mRemoteNG/Language/Language.Designer.cs @@ -3486,42 +3486,6 @@ namespace mRemoteNG.Resources.Language { } } - /// - /// Looks up a localized string similar to Token for Openbao/Vault. - /// - internal static string OpenbaoVaultToken { - get { - return ResourceManager.GetString("OpenbaoVaultToken", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Token to access Openbao/Vault server. - /// - internal static string OpenbaoVaultTokenPropertyDescription { - get { - return ResourceManager.GetString("OpenbaoVaultTokenPropertyDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Openbao/Vault Url. - /// - internal static string OpenbaoVaultUrl { - get { - return ResourceManager.GetString("OpenbaoVaultUrl", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The URL of the Openbao/Vault server to retrieve credentials. - /// - internal static string OpenbaoVaultUrlPropertyDescription { - get { - return ResourceManager.GetString("OpenbaoVaultUrlPropertyDescription", resourceCulture); - } - } - /// /// Looks up a localized string similar to Open Connection File.... /// @@ -4566,6 +4530,15 @@ namespace mRemoteNG.Resources.Language { } } + /// + /// Looks up a localized string similar to Secret engine used in Vault/Openbao to store the secret. + /// + internal static string PropertyDescriptionVaultOpenbaoSecretEngine { + get { + return ResourceManager.GetString("PropertyDescriptionVaultOpenbaoSecretEngine", resourceCulture); + } + } + /// /// Looks up a localized string similar to If you want to establish a view only connection to the host select yes.. /// @@ -6901,6 +6874,78 @@ namespace mRemoteNG.Resources.Language { } } + /// + /// Looks up a localized string similar to Vault/Openbao Secret Engine. + /// + internal static string VaultOpenbaoSecretEngine { + get { + return ResourceManager.GetString("VaultOpenbaoSecretEngine", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to KeyValue (Username as Key). + /// + internal static string VaultOpenbaoSecretEngineKeyValue { + get { + return ResourceManager.GetString("VaultOpenbaoSecretEngineKeyValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to LDAP dynamic role. + /// + internal static string VaultOpenbaoSecretEngineLDAPDynamic { + get { + return ResourceManager.GetString("VaultOpenbaoSecretEngineLDAPDynamic", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to LDAP static role. + /// + internal static string VaultOpenbaoSecretEngineLDAPStatic { + get { + return ResourceManager.GetString("VaultOpenbaoSecretEngineLDAPStatic", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Token for Vault/Openbao. + /// + internal static string VaultOpenbaoToken { + get { + return ResourceManager.GetString("VaultOpenbaoToken", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Token to access Vault/Openbao server. + /// + internal static string VaultOpenbaoTokenPropertyDescription { + get { + return ResourceManager.GetString("VaultOpenbaoTokenPropertyDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Vault/Openbao Url. + /// + internal static string VaultOpenbaoUrl { + get { + return ResourceManager.GetString("VaultOpenbaoUrl", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The URL of the Vault/Openbao server to retrieve credentials. + /// + internal static string VaultOpenbaoUrlPropertyDescription { + get { + return ResourceManager.GetString("VaultOpenbaoUrlPropertyDescription", resourceCulture); + } + } + /// /// Looks up a localized string similar to Verify:. /// diff --git a/mRemoteNG/Language/Language.cs-CZ.resx b/mRemoteNG/Language/Language.cs-CZ.resx index 5187d8ab..9fa17507 100644 --- a/mRemoteNG/Language/Language.cs-CZ.resx +++ b/mRemoteNG/Language/Language.cs-CZ.resx @@ -1894,19 +1894,34 @@ mRemoteNG se nyní ukončí a zahájí instalaci. - + - + + + + + + + + + + + + + + + + + + + + + + Upozornit mě pouze při ukončení několika připojení - - - - - - \ No newline at end of file diff --git a/mRemoteNG/Language/Language.de.resx b/mRemoteNG/Language/Language.de.resx index d1bded1b..c12f1f3c 100644 --- a/mRemoteNG/Language/Language.de.resx +++ b/mRemoteNG/Language/Language.de.resx @@ -2063,16 +2063,31 @@ Nightly umfasst Alphas, Betas und Release Candidates. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.el.resx b/mRemoteNG/Language/Language.el.resx index a16ded57..ace2cfb2 100644 --- a/mRemoteNG/Language/Language.el.resx +++ b/mRemoteNG/Language/Language.el.resx @@ -286,16 +286,31 @@ - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.es-AR.resx b/mRemoteNG/Language/Language.es-AR.resx index 31c7ba16..536c97a9 100644 --- a/mRemoteNG/Language/Language.es-AR.resx +++ b/mRemoteNG/Language/Language.es-AR.resx @@ -325,16 +325,31 @@ - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.es.resx b/mRemoteNG/Language/Language.es.resx index bb3cee4d..4dc12c48 100644 --- a/mRemoteNG/Language/Language.es.resx +++ b/mRemoteNG/Language/Language.es.resx @@ -1554,16 +1554,31 @@ mRemoteNG ahora se cerrará y comenzará la instalación. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.fi-FI.resx b/mRemoteNG/Language/Language.fi-FI.resx index 3e0fd1db..d8ed19cc 100644 --- a/mRemoteNG/Language/Language.fi-FI.resx +++ b/mRemoteNG/Language/Language.fi-FI.resx @@ -151,16 +151,31 @@ - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.fr.resx b/mRemoteNG/Language/Language.fr.resx index e1f1dfff..88d73f50 100644 --- a/mRemoteNG/Language/Language.fr.resx +++ b/mRemoteNG/Language/Language.fr.resx @@ -2166,16 +2166,31 @@ Le canal nightly inclut les versions alpha, beta et release candidates. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.hu.resx b/mRemoteNG/Language/Language.hu.resx index 4ffc5bfa..5d5ae888 100644 --- a/mRemoteNG/Language/Language.hu.resx +++ b/mRemoteNG/Language/Language.hu.resx @@ -346,16 +346,31 @@ - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.it.resx b/mRemoteNG/Language/Language.it.resx index 9243f820..5a1b7dc3 100644 --- a/mRemoteNG/Language/Language.it.resx +++ b/mRemoteNG/Language/Language.it.resx @@ -1572,16 +1572,31 @@ mRemoteNG verrà chiuso e l'installazione avrà inizio. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.ja-JP.resx b/mRemoteNG/Language/Language.ja-JP.resx index ab0fa83d..5e2a58db 100644 --- a/mRemoteNG/Language/Language.ja-JP.resx +++ b/mRemoteNG/Language/Language.ja-JP.resx @@ -1729,16 +1729,31 @@ mRemoteNGを終了してインストールを開始します - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.ko-KR.resx b/mRemoteNG/Language/Language.ko-KR.resx index c41e0cc8..2b537381 100644 --- a/mRemoteNG/Language/Language.ko-KR.resx +++ b/mRemoteNG/Language/Language.ko-KR.resx @@ -1819,16 +1819,31 @@ mRemoteNG는 이제 종료되고 설치로 시작됩니다. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.lt.resx b/mRemoteNG/Language/Language.lt.resx index 67d28290..4cedd646 100644 --- a/mRemoteNG/Language/Language.lt.resx +++ b/mRemoteNG/Language/Language.lt.resx @@ -241,16 +241,31 @@ Nightly Channel includes Alphas, Betas & Release Candidates. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.nb-NO.resx b/mRemoteNG/Language/Language.nb-NO.resx index 833f3687..51efed4b 100644 --- a/mRemoteNG/Language/Language.nb-NO.resx +++ b/mRemoteNG/Language/Language.nb-NO.resx @@ -2018,16 +2018,31 @@ Nightly-kanalen inkluderer alpha-, beta- og release candidate-versjoner. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.nl.resx b/mRemoteNG/Language/Language.nl.resx index 251fc454..cd461392 100644 --- a/mRemoteNG/Language/Language.nl.resx +++ b/mRemoteNG/Language/Language.nl.resx @@ -1601,16 +1601,31 @@ mRemoteNG zal nu worden gesloten en beginnen met de installatie. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.pl.resx b/mRemoteNG/Language/Language.pl.resx index 9d2a68c6..863489b9 100644 --- a/mRemoteNG/Language/Language.pl.resx +++ b/mRemoteNG/Language/Language.pl.resx @@ -2372,16 +2372,31 @@ Kanał nocny obejmuje wersje alfa, beta i RC (gotowe do wydania). - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.pt-BR.resx b/mRemoteNG/Language/Language.pt-BR.resx index 2af65cdf..77fb4202 100644 --- a/mRemoteNG/Language/Language.pt-BR.resx +++ b/mRemoteNG/Language/Language.pt-BR.resx @@ -382,16 +382,31 @@ - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.pt.resx b/mRemoteNG/Language/Language.pt.resx index b3a113c4..6bcaec29 100644 --- a/mRemoteNG/Language/Language.pt.resx +++ b/mRemoteNG/Language/Language.pt.resx @@ -1567,16 +1567,31 @@ - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.resx b/mRemoteNG/Language/Language.resx index 5be5e9fb..61286304 100644 --- a/mRemoteNG/Language/Language.resx +++ b/mRemoteNG/Language/Language.resx @@ -2482,16 +2482,31 @@ Nightly Channel includes Alphas, Betas & Release Candidates. Name or path of the secret - - Token for Openbao/Vault + + Token for Vault/Openbao - - Token to access Openbao/Vault server + + Token to access Vault/Openbao server - - Openbao/Vault Url + + Vault/Openbao Url - - The URL of the Openbao/Vault server to retrieve credentials + + The URL of the Vault/Openbao server to retrieve credentials + + + Vault/Openbao Secret Engine + + + Secret engine used in Vault/Openbao to store the secret + + + KeyValue (Username as Key) + + + LDAP dynamic role + + + LDAP static role \ No newline at end of file diff --git a/mRemoteNG/Language/Language.ru.resx b/mRemoteNG/Language/Language.ru.resx index fb6aad9f..07be01cc 100644 --- a/mRemoteNG/Language/Language.ru.resx +++ b/mRemoteNG/Language/Language.ru.resx @@ -2011,16 +2011,31 @@ mRemoteNG сейчас прекратит работу и начнет проц - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.sv-SE.resx b/mRemoteNG/Language/Language.sv-SE.resx index f70f928d..76b1a293 100644 --- a/mRemoteNG/Language/Language.sv-SE.resx +++ b/mRemoteNG/Language/Language.sv-SE.resx @@ -2185,16 +2185,31 @@ Nattliga kanalen inkluderar Alfa, Betor & Utgåvokandidater. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.ta.resx b/mRemoteNG/Language/Language.ta.resx index 6f80e8dd..6753502a 100644 --- a/mRemoteNG/Language/Language.ta.resx +++ b/mRemoteNG/Language/Language.ta.resx @@ -2429,16 +2429,31 @@ - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.tr-TR.resx b/mRemoteNG/Language/Language.tr-TR.resx index 2f4e23c4..fc9428b2 100644 --- a/mRemoteNG/Language/Language.tr-TR.resx +++ b/mRemoteNG/Language/Language.tr-TR.resx @@ -1641,16 +1641,31 @@ MRemoteNG şimdi kapanacak ve kurulum başlayacak. - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.uk.resx b/mRemoteNG/Language/Language.uk.resx index 96dda122..ee789c43 100644 --- a/mRemoteNG/Language/Language.uk.resx +++ b/mRemoteNG/Language/Language.uk.resx @@ -2015,16 +2015,31 @@ mRemoteNG зараз припинить роботу і почне процес - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.zh-CN.resx b/mRemoteNG/Language/Language.zh-CN.resx index 532b3a63..b1b6f074 100644 --- a/mRemoteNG/Language/Language.zh-CN.resx +++ b/mRemoteNG/Language/Language.zh-CN.resx @@ -2093,16 +2093,31 @@ mRemoteNG 将退出并安装更新。 - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Language/Language.zh-TW.resx b/mRemoteNG/Language/Language.zh-TW.resx index cc02db8a..ac4a7847 100644 --- a/mRemoteNG/Language/Language.zh-TW.resx +++ b/mRemoteNG/Language/Language.zh-TW.resx @@ -1588,16 +1588,31 @@ mRemoteNG 將立即結束並開始安裝。 - + - + - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mRemoteNG/Tree/Root/RootNodeInfo.cs b/mRemoteNG/Tree/Root/RootNodeInfo.cs index 4f327b6d..2cf34641 100644 --- a/mRemoteNG/Tree/Root/RootNodeInfo.cs +++ b/mRemoteNG/Tree/Root/RootNodeInfo.cs @@ -14,8 +14,8 @@ namespace mRemoteNG.Tree.Root { private string _name = Language.Connections; private string _customPassword = ""; - private string _openbaoVaultToken = ""; - private string _openbaoVaultUrl = ""; + private string _vaultOpenbaoToken = ""; + private string _vaultOpenbaoUrl = ""; public RootNodeInfo(RootNodeType rootType) : this(rootType, Guid.NewGuid().ToString()) @@ -66,21 +66,21 @@ namespace mRemoteNG.Tree.Root [LocalizedAttributes.LocalizedCategory(nameof(Language.Miscellaneous)), Browsable(true), LocalizedAttributes.LocalizedDefaultValue(nameof(Language.Connections)), - LocalizedAttributes.LocalizedDisplayName(nameof(Language.OpenbaoVaultUrl)), - LocalizedAttributes.LocalizedDescription(nameof(Language.OpenbaoVaultUrlPropertyDescription))] - public string OpenbaoVaultUrl { - get => _openbaoVaultUrl; - set => _openbaoVaultUrl = value; + LocalizedAttributes.LocalizedDisplayName(nameof(Language.VaultOpenbaoUrl)), + LocalizedAttributes.LocalizedDescription(nameof(Language.VaultOpenbaoUrlPropertyDescription))] + public string VaultOpenbaoUrl { + get => _vaultOpenbaoUrl; + set => _vaultOpenbaoUrl = value; } [LocalizedAttributes.LocalizedCategory(nameof(Language.Miscellaneous)), Browsable(true), LocalizedAttributes.LocalizedDefaultValue(nameof(Language.Connections)), - LocalizedAttributes.LocalizedDisplayName(nameof(Language.OpenbaoVaultToken)), - LocalizedAttributes.LocalizedDescription(nameof(Language.OpenbaoVaultTokenPropertyDescription))] - public string OpenbaoVaultToken { - get => _openbaoVaultToken; - set => _openbaoVaultToken = value; + LocalizedAttributes.LocalizedDisplayName(nameof(Language.VaultOpenbaoToken)), + LocalizedAttributes.LocalizedDescription(nameof(Language.VaultOpenbaoTokenPropertyDescription))] + public string VaultOpenbaoToken { + get => _vaultOpenbaoToken; + set => _vaultOpenbaoToken = value; } #endregion diff --git a/mRemoteNG/UI/Controls/ConnectionInfoPropertyGrid/ConnectionInfoPropertyGrid.cs b/mRemoteNG/UI/Controls/ConnectionInfoPropertyGrid/ConnectionInfoPropertyGrid.cs index 1f1818ca..780b693d 100644 --- a/mRemoteNG/UI/Controls/ConnectionInfoPropertyGrid/ConnectionInfoPropertyGrid.cs +++ b/mRemoteNG/UI/Controls/ConnectionInfoPropertyGrid/ConnectionInfoPropertyGrid.cs @@ -19,11 +19,9 @@ using mRemoteNG.Tree.Root; using mRemoteNG.Resources.Language; using System.Runtime.Versioning; -namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid -{ +namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid { [SupportedOSPlatform("windows")] - public partial class ConnectionInfoPropertyGrid : FilteredPropertyGrid.FilteredPropertyGrid - { + public partial class ConnectionInfoPropertyGrid : FilteredPropertyGrid.FilteredPropertyGrid { private readonly Dictionary> _propertyCache = []; private ConnectionInfo _selectedConnectionInfo; private PropertyMode _propertyMode; @@ -32,11 +30,9 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid /// The currently being shown by this /// property grid. /// - public ConnectionInfo SelectedConnectionInfo - { + public ConnectionInfo SelectedConnectionInfo { get => _selectedConnectionInfo; - set - { + set { if (_selectedConnectionInfo == value) return; @@ -49,11 +45,9 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid /// /// Determines which set of properties this grid will display. /// - public PropertyMode PropertyMode - { + public PropertyMode PropertyMode { get => _propertyMode; - set - { + set { if (_propertyMode == value) return; _propertyMode = value; @@ -82,18 +76,15 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid /// public bool RootNodeSelected { get; private set; } - public ConnectionInfoPropertyGrid() - { + public ConnectionInfoPropertyGrid() { InitializeComponent(); PropertyValueChanged += pGrid_PropertyValueChanged; } - private void SetGridObject() - { + private void SetGridObject() { ClearFilters(); - switch (PropertyMode) - { + switch (PropertyMode) { case PropertyMode.Connection: default: SelectedObject = SelectedConnectionInfo; @@ -113,30 +104,24 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid ShowHideGridItems(); } - private void ShowHideGridItems() - { - try - { + private void ShowHideGridItems() { + try { if (SelectedConnectionInfo == null) return; - if (RootNodeSelected && PropertyMode == PropertyMode.Connection) - { - if (SelectedConnectionInfo is RootPuttySessionsNodeInfo) - { + if (RootNodeSelected && PropertyMode == PropertyMode.Connection) { + if (SelectedConnectionInfo is RootPuttySessionsNodeInfo) { BrowsableProperties = new[] { nameof(RootPuttySessionsNodeInfo.Name) }; - } - else if (SelectedConnectionInfo is RootNodeInfo) - { + } else if (SelectedConnectionInfo is RootNodeInfo) { BrowsableProperties = new[] { nameof(RootNodeInfo.Name), nameof(RootNodeInfo.Password), - nameof(RootNodeInfo.OpenbaoVaultUrl), - nameof(RootNodeInfo.OpenbaoVaultToken) + nameof(RootNodeInfo.VaultOpenbaoUrl), + nameof(RootNodeInfo.VaultOpenbaoToken) }; } @@ -154,8 +139,7 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid List strHide = new(); - if (PropertyMode == PropertyMode.Connection) - { + if (PropertyMode == PropertyMode.Connection) { // hide any inherited properties strHide.AddRange(SelectedConnectionInfo.Inheritance.GetEnabledInheritanceProperties()); @@ -164,8 +148,7 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid strHide.AddRange(SpecialExternalCredentialProviderExclusions()); // ReSharper disable once SwitchStatementMissingSomeCases - switch (SelectedConnectionInfo.Protocol) - { + switch (SelectedConnectionInfo.Protocol) { case ProtocolType.RDP: strHide.AddRange(SpecialRdpExclusions()); break; @@ -180,18 +163,14 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid if (SelectedConnectionInfo is PuttySessionInfo) strHide.Add(nameof(AbstractConnectionRecord.Favorite)); - } - else if (PropertyMode == PropertyMode.DefaultConnection) - { + } else if (PropertyMode == PropertyMode.DefaultConnection) { strHide.Add(nameof(AbstractConnectionRecord.Hostname)); strHide.Add(nameof(AbstractConnectionRecord.Name)); } HiddenProperties = strHide.ToArray(); Refresh(); - } - catch (Exception ex) - { + } catch (Exception ex) { Runtime.MessageCollector.AddMessage( MessageClass.ErrorMsg, Language.ConfigPropertyGridHideItemsFailed + @@ -199,8 +178,7 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid } } - private IEnumerable GetPropertiesForGridObject(object currentGridObject) - { + private IEnumerable GetPropertiesForGridObject(object currentGridObject) { if (_propertyCache.TryGetValue(currentGridObject.GetType(), out IEnumerable properties)) return properties; @@ -211,8 +189,7 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid return props; } - private bool IsValidForProtocol(PropertyInfo property, ProtocolType protocol, bool skipProtocolCheck) - { + private bool IsValidForProtocol(PropertyInfo property, ProtocolType protocol, bool skipProtocolCheck) { return property.GetCustomAttribute()?.Browsable != false && (skipProtocolCheck || property.GetCustomAttribute()? @@ -220,45 +197,38 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid .Contains(protocol) != false); } - private List SpecialExternalAddressProviderExclusions() - { + private List SpecialExternalAddressProviderExclusions() { List strHide = new(); // aws - if (SelectedConnectionInfo.ExternalAddressProvider != ExternalAddressProvider.AmazonWebServices) - { + if (SelectedConnectionInfo.ExternalAddressProvider != ExternalAddressProvider.AmazonWebServices) { strHide.Add(nameof(AbstractConnectionRecord.EC2InstanceId)); strHide.Add(nameof(AbstractConnectionRecord.EC2Region)); } return strHide; } - private List SpecialExternalCredentialProviderExclusions() - { + private List SpecialExternalCredentialProviderExclusions() { List strHide = new(); - if (SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.None) - { + if (SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.None) { strHide.Add(nameof(AbstractConnectionRecord.UserViaAPI)); - strHide.Add(nameof(AbstractConnectionRecord.VaultMount)); - strHide.Add(nameof(AbstractConnectionRecord.VaultRole)); - } - else if (SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.DelineaSecretServer - || SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.ClickstudiosPasswordState) - { + strHide.Add(nameof(AbstractConnectionRecord.VaultOpenbaoMount)); + strHide.Add(nameof(AbstractConnectionRecord.VaultOpenbaoRole)); + } else if (SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.DelineaSecretServer + || SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.ClickstudiosPasswordState) { strHide.Add(nameof(AbstractConnectionRecord.Username)); strHide.Add(nameof(AbstractConnectionRecord.Password)); strHide.Add(nameof(AbstractConnectionRecord.Domain)); - strHide.Add(nameof(AbstractConnectionRecord.VaultMount)); - strHide.Add(nameof(AbstractConnectionRecord.VaultRole)); - } - else if(SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.OnePassword) { - strHide.Add(nameof(AbstractConnectionRecord.VaultMount)); - strHide.Add(nameof(AbstractConnectionRecord.VaultRole)); - } - else if (SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.VaultOpenbao) { + strHide.Add(nameof(AbstractConnectionRecord.VaultOpenbaoMount)); + strHide.Add(nameof(AbstractConnectionRecord.VaultOpenbaoRole)); + } else if (SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.OnePassword) { + strHide.Add(nameof(AbstractConnectionRecord.VaultOpenbaoMount)); + strHide.Add(nameof(AbstractConnectionRecord.VaultOpenbaoRole)); + } else if (SelectedConnectionInfo.ExternalCredentialProvider == ExternalCredentialProvider.VaultOpenbao) { strHide.Add(nameof(AbstractConnectionRecord.UserViaAPI)); - strHide.Add(nameof(AbstractConnectionRecord.Username)); + if (SelectedConnectionInfo.VaultOpenbaoSecretEngine != VaultOpenbaoSecretEngine.Kv) + strHide.Add(nameof(AbstractConnectionRecord.Username)); strHide.Add(nameof(AbstractConnectionRecord.Password)); } return strHide; @@ -267,43 +237,34 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid /// /// /// - private List SpecialRdpExclusions() - { + private List SpecialRdpExclusions() { List strHide = new(); - if (SelectedConnectionInfo.RDPMinutesToIdleTimeout <= 0) - { + if (SelectedConnectionInfo.RDPMinutesToIdleTimeout <= 0) { strHide.Add(nameof(AbstractConnectionRecord.RDPAlertIdleTimeout)); } - if (SelectedConnectionInfo.RDGatewayUsageMethod == RDGatewayUsageMethod.Never) - { + if (SelectedConnectionInfo.RDGatewayUsageMethod == RDGatewayUsageMethod.Never) { strHide.Add(nameof(AbstractConnectionRecord.RDGatewayDomain)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayHostname)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayPassword)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayUseConnectionCredentials)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayUsername)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayAccessToken)); - } - else if (SelectedConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes || - SelectedConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard) - { + } else if (SelectedConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes || + SelectedConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard) { strHide.Add(nameof(AbstractConnectionRecord.RDGatewayDomain)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayPassword)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayUsername)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayExternalCredentialProvider)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayUserViaAPI)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayAccessToken)); - } - else if (SelectedConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.ExternalCredentialProvider) - { + } else if (SelectedConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.ExternalCredentialProvider) { strHide.Add(nameof(AbstractConnectionRecord.RDGatewayDomain)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayPassword)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayUsername)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayAccessToken)); - } - else if (SelectedConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.AccessToken) - { + } else if (SelectedConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.AccessToken) { strHide.Add(nameof(AbstractConnectionRecord.RDGatewayDomain)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayPassword)); strHide.Add(nameof(AbstractConnectionRecord.RDGatewayUsername)); @@ -312,23 +273,19 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid } if (!(SelectedConnectionInfo.Resolution == RDPResolutions.FitToWindow || - SelectedConnectionInfo.Resolution == RDPResolutions.Fullscreen)) - { + SelectedConnectionInfo.Resolution == RDPResolutions.Fullscreen)) { strHide.Add(nameof(AbstractConnectionRecord.AutomaticResize)); } - if (SelectedConnectionInfo.RedirectDiskDrives != RDPDiskDrives.Custom) - { + if (SelectedConnectionInfo.RedirectDiskDrives != RDPDiskDrives.Custom) { strHide.Add(nameof(AbstractConnectionRecord.RedirectDiskDrivesCustom)); } - if (SelectedConnectionInfo.RedirectSound != RDPSounds.BringToThisComputer) - { + if (SelectedConnectionInfo.RedirectSound != RDPSounds.BringToThisComputer) { strHide.Add(nameof(AbstractConnectionRecord.SoundQuality)); } - if (!SelectedConnectionInfo.UseVmId) - { + if (!SelectedConnectionInfo.UseVmId) { strHide.Add(nameof(AbstractConnectionRecord.VmId)); strHide.Add(nameof(AbstractConnectionRecord.UseEnhancedMode)); } @@ -336,17 +293,14 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid return strHide; } - private List SpecialVncExclusions() - { + private List SpecialVncExclusions() { List strHide = new(); - if (SelectedConnectionInfo.VNCAuthMode == ProtocolVNC.AuthMode.AuthVNC) - { + if (SelectedConnectionInfo.VNCAuthMode == ProtocolVNC.AuthMode.AuthVNC) { strHide.Add(nameof(AbstractConnectionRecord.Username)); strHide.Add(nameof(AbstractConnectionRecord.Domain)); } - if (SelectedConnectionInfo.VNCProxyType == ProtocolVNC.ProxyType.ProxyNone) - { + if (SelectedConnectionInfo.VNCProxyType == ProtocolVNC.ProxyType.ProxyNone) { strHide.Add(nameof(AbstractConnectionRecord.VNCProxyIP)); strHide.Add(nameof(AbstractConnectionRecord.VNCProxyPassword)); strHide.Add(nameof(AbstractConnectionRecord.VNCProxyPort)); @@ -356,19 +310,14 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid return strHide; } - private void UpdateConnectionInfoNode(PropertyValueChangedEventArgs e) - { + private void UpdateConnectionInfoNode(PropertyValueChangedEventArgs e) { if (IsShowingInheritance) return; - if (e.ChangedItem.Label == Language.Protocol) - { + if (e.ChangedItem.Label == Language.Protocol) { SelectedConnectionInfo.SetDefaultPort(); - } - else if (e.ChangedItem.Label == Language.Name) - { - if (Settings.Default.SetHostnameLikeDisplayName) - { + } else if (e.ChangedItem.Label == Language.Name) { + if (Settings.Default.SetHostnameLikeDisplayName) { if (!string.IsNullOrEmpty(SelectedConnectionInfo.Name)) SelectedConnectionInfo.Hostname = SelectedConnectionInfo.Name; } @@ -378,51 +327,41 @@ namespace mRemoteNG.UI.Controls.ConnectionInfoPropertyGrid DefaultConnectionInfo.Instance.SaveTo(Settings.Default, a => "ConDefault" + a); } - private void UpdateRootInfoNode(PropertyValueChangedEventArgs e) - { + private void UpdateRootInfoNode(PropertyValueChangedEventArgs e) { if (!(SelectedObject is RootNodeInfo rootInfo)) return; if (e.ChangedItem.PropertyDescriptor?.Name != "Password") return; - if (rootInfo.Password) - { + if (rootInfo.Password) { string passwordName = Properties.OptionsDBsPage.Default.UseSQLServer ? Language.SQLServer.TrimEnd(':') : Path.GetFileName(Runtime.ConnectionsService.GetStartupConnectionFileName()); Optional password = MiscTools.PasswordDialog(passwordName); // operation cancelled, dont set a password - if (!password.Any() || password.First().Length == 0) - { + if (!password.Any() || password.First().Length == 0) { rootInfo.Password = false; return; } rootInfo.PasswordString = password.First().ConvertToUnsecureString(); - } - else - { + } else { rootInfo.PasswordString = ""; } } - private void UpdateInheritanceNode() - { + private void UpdateInheritanceNode() { if (IsShowingDefaultProperties && IsShowingInheritance) DefaultConnectionInheritance.Instance.SaveTo(Settings.Default, a => "InhDefault" + a); } - private void pGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) - { - try - { + private void pGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { + try { UpdateConnectionInfoNode(e); UpdateRootInfoNode(e); UpdateInheritanceNode(); ShowHideGridItems(); - } - catch (Exception ex) - { + } catch (Exception ex) { Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.ConfigPropertyGridValueFailed + Environment.NewLine + ex.Message, true);