1

我在使用Spring Social進行一些與Linkedin身份驗證相關的問題。使用Linkedin進行身份驗證時出現SSLHandshakeException

到目前爲止,我可以在我的http://localhost:8080/signin服務器,其中一個鏈接上點擊auth/linkedin重定向到https://www.linkedin.com/uas/oauth2/authorization?...,它允許訪問後,重定向回http://localhost:8080/auth/linkedin?...上打開一個表格。

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 
... 
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 
... 
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 
... 
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 

我從專家很遠,當談到證書:在這一點上,我的服務器POST到https://www.linkedin.com/uas/oauth2/accessToken,但失敗。據我所知,Linkedins證書被拒絕。爲了被接受,Linkedins證書或者發佈它的證書頒發機構的證書必須位於我的信任庫中。

錯誤表明我沒有。因此,一種解決方案似乎只是將證書頒發機構的證書導入到信任存儲中。

這似乎是不好的做法。我假設我正在與linkedin交談,但是信任鏈的重點不是假設,而是要證明某人的身份,在這種情況下,這種情況還沒有發生。如果我只是假設某人,如果他們說他們是誰,證書就失去價值。

此外,似乎我不應該得到這個錯誤的第一位。我還沒有發現其他人與Linkedin有問題,我很難相信他們不會使用認可的證書頒發機構。那麼,這可能是問題的根源呢?

回答

0

原來,在我忘記了開發的早期階段,我爲一些自簽名證書創建了一個新的密鑰庫,並設置了「-Djavax.net.ssl.trustStore = ...」。這取代默認cacerts密鑰庫。現在我已將我的證書導入到cacerts中。