WCF UserNamePasswordValidator - 验证后访问凭据 [英] WCF UserNamePasswordValidator - Access credentials after validation

查看:436
本文介绍了WCF UserNamePasswordValidator - 验证后访问凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 UserNamePasswordValidator 类的用户名安全与WCF的一部分。这一切的伟大工程和类的验证函数被调用,并正常工作。

I am using the UserNamePasswordValidator class as part of the UserName security with WCF. This all works great and the Validate function of the class gets called and works properly.

那么,如何可以找到什么用户名在我的服务功能被使用?

How then can I find out what UserName was used in my service functions?

举例说,如果一个客户端连接并请求列表使用像

For example say if a client connects and requests a list of logs using something like

IList<Log> Logs() { ... }

这功能怎么能知道哪些USERNAME已在该请求中使用?

How can that function know which UserName was used on that request?

我想要做的就是登录哪个用户名,调用服务中的哪些功能是什么。

What I want to do is log what UserName calls what function within the service.

推荐答案

不知道,但你可能会寻找

Not sure, but you may be looking for

var userName = OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name;

这篇关于WCF UserNamePasswordValidator - 验证后访问凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆