gpt4 book ai didi

asp.net - Azure ACS 身份验证如何确保安全?

转载 作者:行者123 更新时间:2023-12-02 10:19:17 25 4
gpt4 key购买 nike

感谢 Gaurav Mantri 回答我之前的问题 Azure ACS Set Up in C# .

但是有人可以向我解释一下,以下行是如何保护的吗?

if (!ClaimsPrincipal.Current.Identity.IsAuthenticated)

ACS 模式中的客户端很方便地是一个中间人,例如,他可能无法登录 Facebook,并且这会被转发到 ACS(我假设这部分是安全的),但现在 ACS 告诉客户将故障返回给依赖方。

最后一部分是如何固定的?什么阻止客户端将 ACS 消息“失败”篡改为“成功”? Asp.Net 如何知道如何验证签名和解密消息?

就此而言,使用什么 key 来加密/签署消息交换?在 webfarm/Azure 环境中这将如何工作?

最佳答案

您指定将用于消息交换的 key 。

在管理门户中配置 Azure ACS 时,指定将用于签署 token 的私钥(“证书和 key ”选项卡)。

将 Web 应用程序配置为使用 Azure ACS 时,对用于验证签名的证书的引用将添加到 web.config 中:

<issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry">
<authority name="https://xxxxx.accesscontrol.windows.net/">
<keys>
<add thumbprint="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />
</keys>
<validIssuers>
<add name="https://xxxxx.accesscontrol.windows.net/" />
</validIssuers>
</authority>
</issuerNameRegistry>

更新ACS 将证书连同 X509Certificate 元素中的签名安全 token 一起传递到 Web 应用程序(我已删除 namespace ):

<RequestSecurityTokenResponse>
<Lifetime>
<Created>2013-06-19T06:15:16.618Z</Created>
<Expires>2013-06-19T07:15:16.618Z</Expires>
</Lifetime>
<AppliesTo>
<EndpointReference>
<Address>http://xxx.cloudapp.net/</Address>
</EndpointReference>
</AppliesTo>
<RequestedSecurityToken>
<Assertion ID="xxx" IssueInstant="2013-06-19T06:15:16.636Z" Version="2.0" xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
<Issuer>https://xxx.accesscontrol.windows.net/</Issuer>
<Signature>
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<Reference URI="xxx">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
<DigestValue>xxx</ds:DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>xxx</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>xxx</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
<Subject>
<NameID>iiiii</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" />
</Subject>
<Conditions NotBefore="2013-06-19T06:15:16.618Z" NotOnOrAfter="2013-06-19T07:15:16.618Z">
<AudienceRestriction><Audience>http://xxx.cloudapp.net/</Audience></AudienceRestriction>
</Conditions>
<AttributeStatement>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"><AttributeValue>aaa</AttributeValue></Attribute>
</AttributeStatement>
<AuthnStatement AuthnInstant="2013-06-19T06:15:15.999Z">
<AuthnContext>
<AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</Assertion>

关于asp.net - Azure ACS 身份验证如何确保安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17081609/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com