【问题标题】:Asp.NET Principal WebORB HttpHandlerAsp.NET 主体 WebORB HttpHandler
【发布时间】:2009-12-01 18:19:12
【问题描述】:

我有一个 Flex-WebORB-Asp.NET 应用程序。登录时,有一个AuthenticationHandler,它实现了一个WebORB接口:

IPrincipal CheckCredentials(string username, string password, Request message);

所以我创建了一个 Principal 并返回它。 WebORB 使用 Principal 检查远程方法调用的身份验证和授权。

var principal = new GenericPrincipal(new GenericIdentity(user.id.ToString()), new[] { "admin" });
return principal

现在,如果我检查 HttpContext.Current.User.Identity 是什么,它是一个 WindowsIdentity。

到目前为止一切顺利。稍后,通过 WebORB 完成远程调用,我通过调用获取登录用户的 id:

Thread.CurrentPrincipal.Identity.Name

所以我猜 WebORB 会确保每次远程调用都设置线程的标识。

问题是,当我调用 HttpHandler(检索图像)时,我还尝试使用 Thread.CurrentPrincipal.Identity.Name 获取登录用户的 id,但这不起作用。可能是因为有了 HttpHandler,WebORB 不会起作用。

您将如何解决这个问题,以便在这两种情况下我都能以相同的方式获取登录用户的 ID?把它放在一个会话对象中?你能改变HttpContext.Current.User.Identity吗? HttpContext.Current.User.Identity 不应该和Thread.CurrentPrincipal.Identity.Name 一样吗?

ps:用户不在 Active Directory 中。

【问题讨论】:

    标签: .net asp.net authentication weborb iprincipal


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-09
      • 2011-06-05
      • 2010-11-14
      • 1970-01-01
      • 1970-01-01
      • 2010-11-14
      相关资源
      最近更新 更多