[英]Mutual authentication with Spark Java
我正在嘗試使用spark-java和從文檔中獲得相互認證的REST API服務器,我看到:
安全(keystoreFilePath,keystorePassword,truststoreFilePath,truststorePassword);
...看起來正是我所需要的。 但是,我只能以一種方式對服務器進行身份驗證,客戶端證書似乎從未針對信任庫進行驗證。 我使用的是2.1版,任何建議或建議都將不勝感激。
似乎版本2.6.0中的Spark已添加了您所需的內容。 現在,有第二個版本的secure
:
/** (...) * @param needsClientCert Whether to require client certificate to be supplied in * request (...) */ public synchronized Service secure(String keystoreFile, String keystorePassword, String truststoreFile, String truststorePassword, boolean needsClientCert)
它在基礎Jetty Web服務器SslContextFactory對象上設置setNeedClientAuth(true)
和setWantClientAuth(true)
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.