【问题标题】:Windows identity creation using WCF使用 WCF 创建 Windows 标识
【发布时间】:2014-07-25 07:26:41
【问题描述】:

我有一个 WCF REST 服务,它在服务器机器中作为 Windows Authenticated 服务公开。

由于该服务经过 Windows 身份验证,因此我能够使用 API ServiceSecurityContext.Current.WindowsIdentity 在服务器端形成所请求用户的 WindowsIdentity。

问题:

现在我有一台客户端机器正在请求 Windows Authenticated 服务, 在客户端机器中,用户以 clientmachine/testuser 身份登录。使用相同的用户名和密码,服务器机器中还有一个用户(servermachine/testuser),如果请求来自客户端,则 ServiceSecurityContext.Current.WindowsIdentity 给出 服务器机器上用户的windowsidentity(servermachine/testuser)而不是clientmachine/testuser,这是错误的,但是如果密码不同,那么windowsidentity就可以了。

我在服务中做错了什么还是这是 Windows 行为? 请帮助我,在此先感谢。

【问题讨论】:

    标签: c# wcf asp.net-mvc-3 rest iis


    【解决方案1】:

    你尝试过使用模拟,用这个属性装饰你的方法

    [OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
    

    将此添加到配置中

    <behavior name="myServiceBehavior">
        <!-- Other behaviors -->
        <serviceAuthorization impersonateCallerForAllOperations="true" />
    </behavior>
    

    【讨论】:

      猜你喜欢
      • 2013-01-14
      • 1970-01-01
      • 1970-01-01
      • 2012-02-03
      • 2012-05-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-24
      相关资源
      最近更新 更多