private static IAuthenticator GetClassicAuthenticator()
        {
            var authenticator = new ClassicAuthenticator("Administrator", "password");

            authenticator.AddBucketCredential("authenticated", "secret");
            return(authenticator);
        }
Beispiel #2
0
        public void ConnecttoBucket(string bucketName)
        {
            var clusterMan = clusterCB.CreateManager(Db.UserCalculated.ToString(), Db.PassCalculated.ToString());
            IList <BucketConfig> buckets = clusterMan.ListBuckets().Value;
            string bucketpassword        = (from buckConfig in buckets where buckConfig.Name == bucketName select buckConfig.SaslPassword).FirstOrDefault();

            if (bucketpassword == null)
            {
                throw new Exception("No bucket found with name " + bucketName);
            }
            ClassicAuthenticator classicAuthenticator = new ClassicAuthenticator("Administrator", "Administrator");

            classicAuthenticator.AddBucketCredential(bucketName, bucketpassword);
            clusterCB.Authenticate(classicAuthenticator);
        }
Beispiel #3
0
 public bool ConnecttoBucket(string bucketName)
 {
     try
     {
         var    bucket         = clusterCB.OpenBucket(bucketName);
         string bucketpassword = bucket.Configuration.Password;
         ClassicAuthenticator classicAuthenticator = new ClassicAuthenticator(User, Password);
         classicAuthenticator.AddBucketCredential(bucketName, bucketpassword);
         clusterCB.Authenticate(classicAuthenticator);
         //TODO: need to check and true and flase on basis of connection
         return(true);
     }
     catch (Exception ex)
     {
         Reporter.ToLog(eLogLevel.ERROR, "Failed To Connect ConnectToBucket Method In GingerCouchBase DB", ex);
         return(false);
     }
 }
 public bool ConnectToBucket(string bucketName)
 {
     try
     {
         var    bucket         = clusterCB.OpenBucket(bucketName);
         string bucketpassword = bucket.Configuration.Password;
         ClassicAuthenticator classicAuthenticator = new ClassicAuthenticator(Db.DatabaseOperations.UserCalculated.ToString(), Db.DatabaseOperations.PassCalculated.ToString());
         classicAuthenticator.AddBucketCredential(bucketName, bucketpassword);
         clusterCB.Authenticate(classicAuthenticator);
         //TODO: need to check and true and flase on basis of connection
         return(true);
     }
     catch (Exception ex)
     {
         Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex);
         return(false);
     }
 }