diff --git a/TGServiceInterface/Interface.cs b/TGServiceInterface/Interface.cs index 57e024527e..57488c1467 100644 --- a/TGServiceInterface/Interface.cs +++ b/TGServiceInterface/Interface.cs @@ -341,6 +341,7 @@ namespace TGServiceInterface { res.Credentials.UserName.UserName = HTTPSUsername; res.Credentials.UserName.Password = HTTPSPassword; + res.Credentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation; } return res; } diff --git a/TGServiceTests/Interface/TestInterface.cs b/TGServiceTests/Interface/TestInterface.cs index dafa7270db..ebb8ec3751 100644 --- a/TGServiceTests/Interface/TestInterface.cs +++ b/TGServiceTests/Interface/TestInterface.cs @@ -1,6 +1,8 @@ using System; using System.Net; +using System.ServiceModel; using Microsoft.VisualStudio.TestTools.UnitTesting; +using TGServiceInterface.Components; namespace TGServiceInterface.Tests { @@ -10,6 +12,10 @@ namespace TGServiceInterface.Tests [TestClass] public class TestInterface { + /// + /// Name to use for testing s + /// + const string TestInstanceName = "TestInstance"; /// /// Test that can execute successfully /// @@ -76,5 +82,14 @@ namespace TGServiceInterface.Tests Assert.AreEqual(first.HTTPSPort, second.HTTPSPort); Assert.IsTrue(second.IsRemoteConnection); } + + [TestMethod] + public void TestRemoteAccessInterfaceAllowsWindowsImpersonation() + { + var inter = CreateFakeRemoteInterface(); + var po = new PrivateObject(inter); + var cf = (ChannelFactory)po.Invoke("CreateChannel", new Type[] { typeof(string) }, new object[] { TestInstanceName }, new Type[] { typeof(ITGConfig) }); + Assert.AreEqual(cf.Credentials.Windows.AllowedImpersonationLevel, System.Security.Principal.TokenImpersonationLevel.Impersonation); + } } }