/// <summary>
        /// Input method for the keepass plugin.
        /// </summary>
        /// <param name="host">The keepass instance.</param>
        /// <returns>True is correctly initialized.</returns>
        public override bool Initialize(IPluginHost host)
        {
            if (host == null)
            {
                return(false);
            }
            this.host = host;

            // Hook on file opened to check entries in it.
            // Disabled because it takes too much time.
            // But could be re-enabled since the work is done asynchronously now.
            // Could be a setting
            // this.host.MainWindow.FileOpened += this.OnFileOpened;

            var menuItemCollection = this.host.MainWindow.ToolsMenu.DropDownItems;

            this.separator = new ToolStripSeparator();
            menuItemCollection.Add(this.separator);

            // Add menu item
            this.menuItem        = new ToolStripMenuItem();
            this.menuItem.Text   = "Synchronize Vault entries";
            this.menuItem.Click += this.OnMenuItemClick;
            menuItemCollection.Add(this.menuItem);

            this.syncStatus = new SyncStatus();

            return(true);
        }
Ejemplo n.º 2
0
        public SyncStatusForm(SyncStatus syncStatus)
        {
            this.syncStatus = syncStatus;
            InitializeComponent();

            this.syncStatus.NewLog  += SyncStatus_NewLog;
            this.syncStatus.Started += SyncStatus_Started;
            this.syncStatus.Ended   += SyncStatus_Ended;

            this.progressBar.MarqueeAnimationSpeed = 30;
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  Creates a client from credentials
        /// </summary>
        /// <param name="vaultUrl">The Vault URL</param>
        /// <param name="authPath">The Vault auth path. Can be userpass for standard auth method, or the LDAP path in case of LDAP auth.</param>
        /// <param name="vaultLogin">The login</param>
        /// <param name="vaultPassword">The password</param>
        public SynchronousVaultClient(Uri vaultUrl, string authPath, string vaultLogin, string vaultPassword, SyncStatus syncStatus)
        {
            // Disable SSL checks, for self-signed certificates.
            // TODO could be a plugin setting
            System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };

            this.vaultUrl      = vaultUrl;
            this.authPath      = authPath;
            this.vaultLogin    = vaultLogin;
            this.vaultPassword = vaultPassword;
            this.client        = new VaultClient(vaultUrl);
            this.syncStatus    = syncStatus;
        }