gpt4 book ai didi

ssl - ASP.NET MVC 5 外部身份验证与 Twitter 的新策略

转载 作者:太空宇宙 更新时间:2023-11-03 13:03:46 26 4
gpt4 key购买 nike

过去 3 天我一直在尝试这种身份验证方法,但没有成功,我对 MVC 和 Identity 领域完全陌生。我需要通过 Facebook、Microsoft 和 Twitter 对我的站点进行外部身份验证,因此我使用 Identity 2.0 和 MVC 5。Facebook 和 Microsoft 已经完成,但我在为 Twitter 做同样的事情时遇到了麻烦,因为他们去年 12 月更改了身份验证策略,所以现在我需要一个带有 Twitter SSL 证书的 HTTPS 站点(这不是问题)(我有问题这个)。我正在使用 IIS Express 以开发模式运行我的网站。我已经在 Twitter 的开发者网站上创建了我的应用程序,我得到了我的 API key 、API key 、访问 token 和访问 key 。我已经更改了我的 Startup.Auth.cs,以使用我的 consumerKey (ApiKey) 和 consumerSecret (ApiSecret) 取消注释 app.UseTwitterAuthentication。但是当我运行我的网站并尝试使用 Twitter 登录时,我不断收到此错误:根据验证程序,远程证书无效。

查看这些讨论问题: https://dev.twitter.com/discussions/24239 https://dev.twitter.com/docs/security/using-ssl

阅读了一些有关此问题的内容后,我知道需要一个我已获得的 Twitter SSL 证书,但不知道如何使用它。

拜托,我很绝望,我需要解决这个问题,任何人都可以告诉我如何使它与 VS 2013 和 IIS Express 一起工作吗?我不知道该怎么办。

最佳答案

... now I require an HTTPS site (which is not the problem) with a Twitter SSL certificate (I have problems with this one)

根据 Twitter is updating its SSL certificates for api.twitter.com ,签名根更改为 VeriSign Class 3 Public Primary Certification Authority - G5

看起来它已经改变了:

$ openssl s_client -connect api.twitter.com:443
CONNECTED(00000003)
depth=1 C = US, O = "VeriSign, Inc.", OU = VeriSign Trust Network, OU = Terms of use at https://www.verisign.com/rpa (c)10, CN = VeriSign Class 3 Secure Server CA - G3
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=San Francisco/O=Twitter, Inc./OU=Twitter Security/CN=api.twitter.com
i:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)10/CN=VeriSign Class 3 Secure Server CA - G3
1 s:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)10/CN=VeriSign Class 3 Secure Server CA - G3
i:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 2006 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 3 Public Primary Certification Authority - G5
...

转到 Download Verisign Root Certificates并下载 VeriSign Class 3 Primary CA - G5。它有指纹 4e b6 d5 78 49 9b 1c cf 5f 58 1e ad 56 be 3d 9b 67 44 a5 e5

下载证书后,将其导入计算机的根证书颁发机构存储区。有关说明,请参阅 Manage Trusted Root Certificates在 TechNet 上。请务必遵循将证书添加到本地计算机的受信任的根证书颁发机构存储。您需要本地计算机,并且需要受信任的根证书颁发机构存储。

一旦您使用下载的证书作为信任 anchor ,链就会进行验证。注意 -CAfile 选项,以及最后的 Verify return code: 0 (ok):

$ openssl s_client -connect api.twitter.com:443 -CAfile VeriSign-Class\ 3-Public-Primary-Certification-Authority-G5.pem 
CONNECTED(00000003)
depth=2 C = US, O = "VeriSign, Inc.", OU = VeriSign Trust Network, OU = "(c) 2006 VeriSign, Inc. - For authorized use only", CN = VeriSign Class 3 Public Primary Certification Authority - G5
verify return:1
depth=1 C = US, O = "VeriSign, Inc.", OU = VeriSign Trust Network, OU = Terms of use at https://www.verisign.com/rpa (c)10, CN = VeriSign Class 3 Secure Server CA - G3
verify return:1
depth=0 C = US, ST = California, L = San Francisco, O = "Twitter, Inc.", OU = Twitter Security, CN = api.twitter.com
verify return:1
---
Certificate chain
0 s:/C=US/ST=California/L=San Francisco/O=Twitter, Inc./OU=Twitter Security/CN=api.twitter.com
i:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)10/CN=VeriSign Class 3 Secure Server CA - G3
1 s:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)10/CN=VeriSign Class 3 Secure Server CA - G3
i:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=(c) 2006 VeriSign, Inc. - For authorized use only/CN=VeriSign Class 3 Public Primary Certification Authority - G5
---
...

Start Time: 1407206791
Timeout : 300 (sec)
Verify return code: 0 (ok)

关于ssl - ASP.NET MVC 5 外部身份验证与 Twitter 的新策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25122584/

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