我有一个自定义密码验证器,它是 System.IdentityModel.Selectors.UserNamePasswordValidator
的扩展。如何从服务中获取用户名?
最佳答案
如果你只想要用户名:
OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name
如果您需要用户名和密码,Rory Primrose 在他的文章 WCF Security: Getting the password of the user 中对此进行了解释。
关于wcf - (WCF)如何在我的服务中获取登录客户端的用户名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8657657/