DorCMIS: allow authentication providers to handle responses
git-svn-id: https://svn.apache.org/repos/asf/chemistry/dotcmis/trunk@1101123 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/DotCMIS/binding/binding-impl.cs b/DotCMIS/binding/binding-impl.cs
index f79e408..cabaf63 100644
--- a/DotCMIS/binding/binding-impl.cs
+++ b/DotCMIS/binding/binding-impl.cs
@@ -142,6 +142,11 @@
return spi.GetPolicyService();
}
+ public IAuthenticationProvider GetAuthenticationProvider()
+ {
+ return session.GetAuthenticationProvider();
+ }
+
public void ClearAllCaches()
{
CheckSession();
@@ -375,9 +380,9 @@
return GetValue(TypeDefinitionCache) as TypeDefinitionCache;
}
- public AbstractAuthenticationProvider GetAuthenticationProvider()
+ public IAuthenticationProvider GetAuthenticationProvider()
{
- return GetValue(AuthenticationProvider) as AbstractAuthenticationProvider;
+ return GetValue(AuthenticationProvider) as IAuthenticationProvider;
}
public void Lock()
diff --git a/DotCMIS/binding/binding-intf.cs b/DotCMIS/binding/binding-intf.cs
index 945fa98..3318036 100644
--- a/DotCMIS/binding/binding-intf.cs
+++ b/DotCMIS/binding/binding-intf.cs
@@ -38,6 +38,7 @@
IMultiFilingService GetMultiFilingService();
IAclService GetAclService();
IPolicyService GetPolicyService();
+ IAuthenticationProvider GetAuthenticationProvider();
void ClearAllCaches();
void ClearRepositoryCache(string repositoryId);
}
@@ -49,12 +50,23 @@
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;
diff --git a/DotCMIS/binding/http.cs b/DotCMIS/binding/http.cs
index 412b022..8c2e8e1 100644
--- a/DotCMIS/binding/http.cs
+++ b/DotCMIS/binding/http.cs
@@ -103,7 +103,7 @@
}
// authenticate
- AbstractAuthenticationProvider authProvider = session.GetAuthenticationProvider();
+ IAuthenticationProvider authProvider = session.GetAuthenticationProvider();
if (authProvider != null)
{
conn.PreAuthenticate = true;
@@ -141,6 +141,12 @@
try
{
HttpWebResponse response = (HttpWebResponse)conn.GetResponse();
+
+ if (authProvider != null)
+ {
+ authProvider.HandleResponse(response);
+ }
+
return new Response(response);
}
catch (WebException we)
diff --git a/DotCMIS/binding/webservices/webservices.cs b/DotCMIS/binding/webservices/webservices.cs
index a13d477..b68d22b 100644
--- a/DotCMIS/binding/webservices/webservices.cs
+++ b/DotCMIS/binding/webservices/webservices.cs
@@ -328,7 +328,7 @@
portObject = new ACLServicePortClient(binding, new EndpointAddress(wsdlUrl));
}
- AbstractAuthenticationProvider authenticationProvider = session.GetAuthenticationProvider();
+ IAuthenticationProvider authenticationProvider = session.GetAuthenticationProvider();
if (authenticationProvider != null)
{
authenticationProvider.Authenticate(portObject);