You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2011/05/09 19:35:00 UTC

svn commit: r1101123 - in /chemistry/dotcmis/trunk/DotCMIS/binding: binding-impl.cs binding-intf.cs http.cs webservices/webservices.cs

Author: fmui
Date: Mon May  9 17:35:00 2011
New Revision: 1101123

URL: http://svn.apache.org/viewvc?rev=1101123&view=rev
Log:
DorCMIS: allow authentication providers to handle responses

Modified:
    chemistry/dotcmis/trunk/DotCMIS/binding/binding-impl.cs
    chemistry/dotcmis/trunk/DotCMIS/binding/binding-intf.cs
    chemistry/dotcmis/trunk/DotCMIS/binding/http.cs
    chemistry/dotcmis/trunk/DotCMIS/binding/webservices/webservices.cs

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/binding-impl.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/binding-impl.cs?rev=1101123&r1=1101122&r2=1101123&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/binding-impl.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/binding-impl.cs Mon May  9 17:35:00 2011
@@ -142,6 +142,11 @@ namespace DotCMIS.Binding.Impl
             return spi.GetPolicyService();
         }
 
+        public IAuthenticationProvider GetAuthenticationProvider()
+        {
+            return session.GetAuthenticationProvider();
+        }
+
         public void ClearAllCaches()
         {
             CheckSession();
@@ -375,9 +380,9 @@ namespace DotCMIS.Binding.Impl
             return GetValue(TypeDefinitionCache) as TypeDefinitionCache;
         }
 
-        public AbstractAuthenticationProvider GetAuthenticationProvider()
+        public IAuthenticationProvider GetAuthenticationProvider()
         {
-            return GetValue(AuthenticationProvider) as AbstractAuthenticationProvider;
+            return GetValue(AuthenticationProvider) as IAuthenticationProvider;
         }
 
         public void Lock()

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/binding-intf.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/binding-intf.cs?rev=1101123&r1=1101122&r2=1101123&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/binding-intf.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/binding-intf.cs Mon May  9 17:35:00 2011
@@ -38,6 +38,7 @@ namespace DotCMIS.Binding
         IMultiFilingService GetMultiFilingService();
         IAclService GetAclService();
         IPolicyService GetPolicyService();
+        IAuthenticationProvider GetAuthenticationProvider();
         void ClearAllCaches();
         void ClearRepositoryCache(string repositoryId);
     }
@@ -49,12 +50,23 @@ namespace DotCMIS.Binding
         int GetValue(string key, int defValue);
     }
 
-    public abstract class AbstractAuthenticationProvider
+    public interface IAuthenticationProvider
+    {
+        void Authenticate(object connection);
+
+        void HandleResponse(object connection);
+    }
+
+    public abstract class AbstractAuthenticationProvider : IAuthenticationProvider
     {
         public IBindingSession Session { get; set; }
 
         public abstract void Authenticate(object connection);
 
+        public void HandleResponse(object connection)
+        {
+        }
+
         public string GetUser()
         {
             return Session.GetValue(SessionParameter.User) as string;

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/http.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/http.cs?rev=1101123&r1=1101122&r2=1101123&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/http.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/http.cs Mon May  9 17:35:00 2011
@@ -103,7 +103,7 @@ namespace DotCMIS.Binding.Impl
                 }
 
                 // authenticate
-                AbstractAuthenticationProvider authProvider = session.GetAuthenticationProvider();
+                IAuthenticationProvider authProvider = session.GetAuthenticationProvider();
                 if (authProvider != null)
                 {
                     conn.PreAuthenticate = true;
@@ -141,6 +141,12 @@ namespace DotCMIS.Binding.Impl
                 try
                 {
                     HttpWebResponse response = (HttpWebResponse)conn.GetResponse();
+
+                    if (authProvider != null)
+                    {
+                        authProvider.HandleResponse(response);
+                    }
+
                     return new Response(response);
                 }
                 catch (WebException we)

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/webservices/webservices.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/webservices/webservices.cs?rev=1101123&r1=1101122&r2=1101123&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/webservices/webservices.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/webservices/webservices.cs Mon May  9 17:35:00 2011
@@ -328,7 +328,7 @@ namespace DotCMIS.Binding.WebServices
                 portObject = new ACLServicePortClient(binding, new EndpointAddress(wsdlUrl));
             }
 
-            AbstractAuthenticationProvider authenticationProvider = session.GetAuthenticationProvider();
+            IAuthenticationProvider authenticationProvider = session.GetAuthenticationProvider();
             if (authenticationProvider != null)
             {
                 authenticationProvider.Authenticate(portObject);