Removed differences between Pithos and Cloudfiles authentication.
authorPanagiotis Kanavos <pkanavos@gmail.com>
Sun, 18 Sep 2011 17:21:21 +0000 (20:21 +0300)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Sun, 18 Sep 2011 17:21:21 +0000 (20:21 +0300)
Pithos returns the ApiKey and actual URL as Token and Storage Url respectively. Thus it can respond to the auth requests of cloudfiles clients

trunk/Pithos.Client.WPF/App.xaml.cs
trunk/Pithos.Core/JobQueue.cs
trunk/Pithos.Network/CloudFilesClient.cs
trunk/Pithos.sln

index d3bf5db..cfc45b6 100644 (file)
@@ -19,7 +19,7 @@ namespace Pithos.Client.WPF
         public App()
         {
             var extensionController = new ShellExtensionController();
-            extensionController.RegisterExtensions();
+            //extensionController.RegisterExtensions();
             
 
             var appPatth =    Assembly.GetExecutingAssembly().Location;
index 78aa206..9fae16b 100644 (file)
@@ -32,6 +32,9 @@ namespace Pithos.Core
 
         private void ProcessUpdates()
         {
+            Parallel.ForEach(_statusUpdateQueue.GetConsumingEnumerable(),
+                new ParallelOptions{MaxDegreeOfParallelism=1,CancellationToken=_cancellationToken},  
+                action => action());
             foreach (var action in _statusUpdateQueue.GetConsumingEnumerable())
             {
                 action();
index ad1eb77..a32f223 100644 (file)
@@ -58,32 +58,25 @@ namespace Pithos.Network
             UserName = userName;
             ApiKey = apiKey;
             
-            if (UsePithos)
-            {
-                Token = ApiKey;
-                string storageUrl = String.Format("{0}/{1}/{2}", AuthenticationUrl, VersionPath, UserName);
-                StorageUrl = new Uri(storageUrl);
-            }
-            else
-            {
 
-                string authUrl = String.Format("{0}/{1}", AuthenticationUrl, VersionPath);
-                var authClient = new PithosClient{BaseAddress= authUrl};
+            using (var authClient = new PithosClient{BaseAddress=AuthenticationUrl})
+            {
                 if (Proxy != null)
                     authClient.Proxy = new WebProxy(Proxy);
 
                 authClient.Headers.Add("X-Auth-User", UserName);
                 authClient.Headers.Add("X-Auth-Key", ApiKey);
 
-                var response = authClient.DownloadStringWithRetry("",3);
+                authClient.DownloadStringWithRetry(VersionPath, 3);
 
                 authClient.AssertStatusOK("Authentication failed");
 
-                string storageUrl = authClient.GetHeaderValue("X-Storage-Url");
+                var storageUrl = authClient.GetHeaderValue("X-Storage-Url");
                 if (String.IsNullOrWhiteSpace(storageUrl))
                     throw new InvalidOperationException("Failed to obtain storage url");
                 StorageUrl = new Uri(storageUrl);
-
+                UriBuilder b;
+                b.Scheme;
                 var token = authClient.GetHeaderValue("X-Auth-Token");
                 if (String.IsNullOrWhiteSpace(token))
                     throw new InvalidOperationException("Failed to obtain token url");
index 20d762c..a965b2d 100644 (file)
@@ -48,7 +48,6 @@ Global
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
                {240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
                {240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
                {240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|x86.ActiveCfg = Debug|Any CPU