WCF - 传输认证 - 获取认证用户身份凭证 [英] WCF - Transport Authentication - Get Credentials of Authenticated User

查看:162
本文介绍了WCF - 传输认证 - 获取认证用户身份凭证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 NetTcpBinding的 SecurityMode.TransportWithMessageCredential

Transport.ClientCredentialType 设置为 MessageCredentialType.Windows ,但我考虑 MessageCredentialType.UserName

此外,还有一类DataStoreServerProxy为获取它实现IDataStoreContract数据库中的数据。

Then there's a class DataStoreServerProxy for fetching database data which implements IDataStoreContract.

它包含的方法,如这一个:

It contains methods such as this one:

Private Function Common_IDataStoreContract_ModifyData(ByVal ParamArray dmlStatements As ModificationStatement()) As ModificationResult Implements IDataStoreContract.ModifyData
        Return wrappedDataStore.ModifyData(dmlStatements)
    End Function

为了获得该数据库一点,用户必须已经提供的凭据。现在的问题是,如何获得他们的方法呢?根据不同的用户名,我必须决定是否允许访问某些表或不

In order to get to that DB point, user must have already supplied the credentials. The question is, how to obtain them in those methods? Depending on the user name, I have to decide whether to allow access to some tables or not.

推荐答案

用户名可以使用检索 OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name

这篇关于WCF - 传输认证 - 获取认证用户身份凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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