企业库策略注入记录 ASP.NET 中的托管安全上下文信息
我正在使用策略注入应用程序块来记录在我的 ASP.NET 应用程序中调用的方法。我希望这些日志条目包含当前用户身份、用户是否经过身份验证等信息。所有这些信息均由 ManagedSecurityContextInformationProvider
提供,但我不知道如何让 PIAB 使用该提供程序以及如何将该信息放入我的日志文件中。
我可能遗漏了一些明显的东西,但我不太清楚它是什么。
I am using The Policy Injection Application Block to log methods that are called in my ASP.NET application. I would like these log entries to include information like the current user identity, whether the user is authenticated and so forth. All of this information is provided by the ManagedSecurityContextInformationProvider
, but I can't figure out how to get the PIAB to use that provider and how to get that information into my log file.
I may be missing something obvious, but I can't quite figure out what it is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,似乎无法将 ManagedSecurityContextInformationProvider 信息获取到方法调用日志中。该信息通常记录在扩展属性中,但 LogCallHandler.GetLogEntry 方法转储所有方法参数并将它们分配给 TraceLogEntry ExtendedProperties。
在我看来,您可以修改块以添加该信息,或者(甚至更好)基于 LogCallHandler 创建您自己的自定义调用处理程序来添加您需要的信息。这两种选择都不需要太多工作。
Sorry to say, it looks like there is no way to get the ManagedSecurityContextInformationProvider information into method call logs. That information is usually logged in extended properties but the LogCallHandler.GetLogEntry method dumps out all of the method parameters and assigns them to the TraceLogEntry ExtendedProperties.
It seems to me that you could either modify the block to add that information or (even better) create your own Custom Call Handler based on LogCallHandler that adds the information that you require. Either option is not that much work.