예제 #1
0
 private static ClientInstance Login( VaultRepositoryAuthSettings connectionSettings )
 {
     ClientInstance myClient = new ClientInstance();
     myClient.Init( VaultClientNetLib.VaultConnection.AccessLevelType.Client );
     myClient.Login( connectionSettings.Url, connectionSettings.User, connectionSettings.Password );
     FindRepository( myClient, connectionSettings.Repository );
     return myClient;
 }
예제 #2
0
        private static ClientInstance Login(VaultRepositoryAuthSettings connectionSettings)
        {
            ClientInstance myClient = new ClientInstance();

            myClient.Init(VaultClientNetLib.VaultConnection.AccessLevelType.Client);
            myClient.Login(connectionSettings.Url, connectionSettings.User, connectionSettings.Password);
            FindRepository(myClient, connectionSettings.Repository);
            return(myClient);
        }
예제 #3
0
        protected void EstablishConnection()
        {
            if (server.StartsWith("http://") == false)
                server = "http://" + server;

            if (server.EndsWith("/VaultService") == false)
                server += "/VaultService";

            ClientInstance myClient = new ClientInstance();
            myClient.Init(VaultClientNetLib.VaultConnection.AccessLevelType.Client);
            myClient.Login(server, username, password);

            FindRepository(myClient, repository);

            client = myClient;

            root = Client.TreeCache.Repository.Root;
        }
예제 #4
0
        /// <summary>
        /// This function logs into the Vault server and chooses the appropriate repository.  It checks
        /// for a valid username, password, and successful login to the server.
        /// </summary>
        /// <exception>Exception</exception>
        public void Login()
        {
            if (Url.Length != 0 && Username.Length != 0)
            {
                ClientInstance.Init(_accessLevel);

                //Fixed Case to match properly.
                if (Url.ToLower().EndsWith("/vaultservice") == false)
                {
                    Url += "/VaultService";
                }
                if (Url.ToLower().StartsWith("http://") == false && Url.ToLower().StartsWith("https://") == false)
                {
                    Url = "http://" + Url;
                }

                ClientInstance.Login(Url, Username, Password);

#if VAULT_3_5
                ClientInstance.EventEngine.addListener(this, typeof(StatusMessageEvent));
#else
                ClientInstance.StatusChanged += new StatusChangedEventHandler(StatusChangedHandler);
#endif

                if (ClientInstance.ConnectionStateType != ConnectionStateType.Connected)
                {
                    throw new Exception(Resources.VaultLoginFailed);
                }
            }
            else
            {
                if (Url.Length == 0)
                {
                    throw new Exception(Resources.VaultIncorrectParameters + "  " + Resources.VaultUrlRequired);
                }
                if (Username.Length == 0)
                {
                    throw new Exception(Resources.VaultIncorrectParameters + "  " + Resources.VaultUsernameRequired);
                }
            }
        }
        protected void EstablishConnection()
        {
            if (server.StartsWith("http://") == false)
            {
                server = "http://" + server;
            }

            if (server.EndsWith("/VaultService") == false)
            {
                server += "/VaultService";
            }

            ClientInstance myClient = new ClientInstance();

            myClient.Init(VaultClientNetLib.VaultConnection.AccessLevelType.Client);
            myClient.Login(server, username, password);

            FindRepository(myClient, repository);

            client = myClient;

            root = Client.TreeCache.Repository.Root;
        }