Azure ACS身份验证是如何安全的?

时间:2013-06-13 07:34:21

标签: asp.net security encryption azure acs

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

然而,有人可以向我解释,以下行如何安全

if (!ClaimsPrincipal.Current.Identity.IsAuthenticated)

ACS模式中的客户端很方便地是 man in the middle ,他可能无法登录到Facebook,例如,这会被转发到ACS(我假设这部分是安全的),但现在ACS正在告诉客户关于失败的情况回到依赖方。

最后一部分如何获得保障?什么阻止客户端篡改ACS消息“失败”到“成功”? Asp.Net如何知道如何验证签名并解密消息?

就此而言用什么密钥来加密/签署邮件交换?那在webfarm / Azure环境中如何工作?

1 个答案:

答案 0 :(得分:5)

指定将用于消息交换的密钥。

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

将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元素中的签名安全令牌一起传递给Web应用程序(我删除了名称空间):

<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>