Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 找出哪个联邦伙伴向WIF颁发了令牌 我有一个应用程序,它使用Windows身份基础来实现多个伙伴的联合单点登录(我们称之为Org1、Org2、Org3等)。因此,我的WIF配置包含所有合作伙伴证书的指纹-配置如下(为了简洁起见,省略了不相关的部分):_Asp.net_Wif_Adfs_Federated Identity_Ws Federation - Fatal编程技术网

Asp.net 找出哪个联邦伙伴向WIF颁发了令牌 我有一个应用程序,它使用Windows身份基础来实现多个伙伴的联合单点登录(我们称之为Org1、Org2、Org3等)。因此,我的WIF配置包含所有合作伙伴证书的指纹-配置如下(为了简洁起见,省略了不相关的部分):

Asp.net 找出哪个联邦伙伴向WIF颁发了令牌 我有一个应用程序,它使用Windows身份基础来实现多个伙伴的联合单点登录(我们称之为Org1、Org2、Org3等)。因此,我的WIF配置包含所有合作伙伴证书的指纹-配置如下(为了简洁起见,省略了不相关的部分):,asp.net,wif,adfs,federated-identity,ws-federation,Asp.net,Wif,Adfs,Federated Identity,Ws Federation,。。。如何使用主体/消息/令牌变量(或者完全使用其他方法)来确定是Org1、Org2还是Org3向我发送了令牌?我知道关于token.Assertion.Issuer,但这似乎直接来自于该令牌,因此似乎Org1可以发布一个令牌,将Org2列为发行者,从而导致模拟攻击。是否有一种方法可以安全地识别颁发组织,根据哪个证书用于令牌验证?我找到了两种解决方案: 方法1: 创建从System.IdentityModel.Tokens.ConfigurationBaseDisqueryNameRegistr

。。。如何使用
主体
/
消息
/
令牌
变量(或者完全使用其他方法)来确定是Org1、Org2还是Org3向我发送了令牌?我知道关于
token.Assertion.Issuer
,但这似乎直接来自于该令牌,因此似乎Org1可以发布一个令牌,将Org2列为发行者,从而导致模拟攻击。是否有一种方法可以安全地识别颁发组织,根据哪个证书用于令牌验证?

我找到了两种解决方案:

方法1:

创建从
System.IdentityModel.Tokens.ConfigurationBaseDisqueryNameRegistry
派生的自定义
IssuerNameRegistry
,并将其设置为您的名称注册表(例如

在自定义注册表中,重写同时接受令牌和字符串的
GetIssuerName
重载(根据令牌本身,它是令牌的颁发者

在这个重写中,调用base
GetIssuerName
方法,您将获得
name
属性,您可以在
Thread.CurrentPrincipal上获得
声明
,作为ClaimsPrincipal
,并且每个
声明
都有一个
颁发者
属性。事实证明,对于实际用于验证令牌签名的证书,此属性将始终设置为
语句中的
name
属性

这有点不方便-如果您正在处理WS-Federation sign-in响应,则无法知道此特定响应的
标记来自何处-您正在查看声明可能来自多个来源的当前标识。但我认为在大多数现实情况下,这应该足够了

<system.identityModel>
<identityConfiguration>    
  <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry">
    <trustedIssuers>
      <add name="Org1" thumbprint="...certificate1..." />
      <add name="Org2" thumbprint="...certificate2..." />
      <add name="Org3" thumbprint="...certificate3..." />
    </trustedIssuers>
  </issuerNameRegistry>
</identityConfiguration>
        var authModule = FederatedAuthentication.WSFederationAuthenticationModule;
        var request = new HttpRequestWrapper(Request);

        if (authModule.CanReadSignInResponse(request, true))
        {
            var principal = Thread.CurrentPrincipal;
            var message = authModule.GetSignInResponseMessage(request);
            var token = authModule.GetSecurityToken(request) as SamlSecurityToken;
            //???
        }
class ValidatingConfigurationBasedIssuerNameRegistry : ConfigurationBasedIssuerNameRegistry
{
    public override string GetIssuerName(SecurityToken securityToken, string requestedIssuerName)
    {
        var configuredName = base.GetIssuerName(securityToken, requestedIssuerName);
        return (configuredName == requestedIssuerName) ? configuredName : null;
    }
}