2017-08-09 114 views
0

我有一個ASP.NET Core 1.1項目,使用Azure AD OpenID進行身份驗證。身份驗證在我的開發盒(Windows 10)上正常工作,無論是在IIS Express還是完整的IIS上。但是,當我將項目部署到我的服務器(Server 2008R2)後,在登錄到Microsoft重定向站點後,服務器會拋出此錯誤:ASP.NET Core Azure AD OpenID - 生產服務器上的令牌簽名驗證失敗

Microsoft.IdentityModel.Tokens.SecurityTokenInvalidSignatureException:IDX10503:簽名驗證失敗。鍵嘗試:「Microsoft.IdentityModel.Tokens.X509SecurityKey,KEYID:VWVIc1WD1Tksbb301sasM5kOq5Q Internal.Cryptography.CryptoThrowHelper + WindowsCryptographicException:在Internal.Cryptography.Helpers.OpenStorageProvider(CngProvider提供商) 發生內部錯誤 在System.Security.Cryptography.CngKey .Inport(Byte [] keyBlob,String curveName,CngKeyBlobFormat format,CngProvider provider) at System.Security.Cryptography.CngKey.Import(Byte [] keyBlob,CngKeyBlobFormat format) at Internal.Cryptography.Pal.X509Pal.DecodePublicKey(Oid oid,Byte [] encodedKeyValue,Byte [] encodedParameters,ICertificatePal certificatePal) at Microsoft.Office.Cryptography.Pal.CertificateExtensionsCommon.GetPublicKey [T](X509Certificate2 certificate,Predicate`1 matchesConstraints) 。 IdentityModel.Tokens.X509SecurityKey.get_PublicKey() at Microsoft.IdentityModel.Tokens.CryptoProviderFactory.IsSupportedAlgorithm(String algorithm,SecurityKey key) at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(Byte [] encodedBytes,Byte [] signature ,SecurityKey鍵,字符串算法,TokenValidationParameters validationParameters) 在System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(字符串令牌,TokenValidationParameters validationParameters)

當我從天青接收的令牌,並且將其插入JWT.io它會成功驗證簽名。

要回顧一下:

  • 開發框(IIS Express和IIS)令牌簽名驗證成功
  • JWT.io調試現場,令牌和簽名驗證成功
  • 部署在服務器(IIS 7.5)簽名驗證失敗

它與我在服務器上的https證書有什麼關係?在我的開發盒上,我使用了使用powershell創建的自簽名證書。在服務器上,我們有一個由爸爸頒發的證書。

感謝您的任何幫助。

回答

0

問題是運行應用程序池的標識。權利不夠高。