問題出在webview組件x-ms-webview
上。 InAppBrowser插件在內部使用此組件。 找到了解決方法中提到here,還挺聽起來像一個安全問題TBH所以這有可能會固定在未來,但這裏有上說,解決方法的詳細信息:
請給這應該觸發虛擬智能卡解鎖的URL的請求訪問用戶證書,但與HttpClient的在本地水平(C#)
我在我的解決方案,做一個簡單的POST到我想從InAppBrowser訪問這個URL創建另一個Windows運行時組件。 設置Windows.Web.Http.HttpClient
時,我從智能卡獲取用戶證書並將其設置爲HttpBaseProtocolFilter.ClientCertificate
。
public sealed class SSLHelper
{
private static String errorMessage = "";
private static String statusMessage = "";
public static IAsyncOperation<Boolean> establishSSLConnection(String url)
{
return connect(url).AsAsyncOperation<Boolean>();
}
public static String getErrorMessage()
{
return SSLHelper.errorMessage;
}
public static String getStatusMessage()
{
return SSLHelper.statusMessage;
}
private static async Task<Boolean> connect(String urlString)
{
Certificate clientCert = await getCertificateAsync();
HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter();
filter.ClientCertificate = clientCert;
HttpClient client = new HttpClient(filter);
try
{
System.Uri url = new System.Uri(urlString);
HttpResponseMessage response = await client.PostAsync(url, new HttpStringContent(""));
response.EnsureSuccessStatusCode();
SSLHelper.statusMessage = response.StatusCode.ToString();
return true;
}
catch (Exception e)
{
SSLHelper.errorMessage = e.ToString();
return false;
}
}
private static async Task<Certificate> getCertificateAsync()
{
CertificateQuery query = new CertificateQuery();
query.IssuerName = "Sample Issuer";
IReadOnlyList<Certificate> certStores = await CertificateStores.FindAllAsync(query);
return certStores.FirstOrDefault<Certificate>();
}
}
作出這樣的代碼回報JavaScript的水平承諾,一旦解決了,開始它採用InAppBrowser再次訪問安全網址的代碼。本地請求會導致PIN提示符進入虛擬智能卡訪問,一旦您輸入了正確的PIN碼,InAppBrowser/WebView就可以神奇地建立連接。