Java 类org.apache.cordova.ICordovaClientCertRequest 实例源码

项目:cordova-client-cert-authentication    文件:ClientCertificateAuthentication.java   
private void loadKeys(ICordovaClientCertRequest request) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(cordova.getActivity());
    final KeyChainAliasCallback callback = new AliasCallback(cordova.getActivity(), request);
    final String alias = sp.getString(SP_KEY_ALIAS, null);

    if (alias == null) {
        KeyChain.choosePrivateKeyAlias(cordova.getActivity(), callback, new String[]{"RSA"}, null, request.getHost(), request.getPort(), null);
    } else {
        ExecutorService threadPool = cordova.getThreadPool();
        threadPool.submit(new Runnable() {
            @Override
            public void run() {
                callback.alias(alias);
            }
        });
    }
}
项目:cordova-client-cert-authentication    文件:ClientCertificateAuthentication.java   
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public boolean onReceivedClientCertRequest(CordovaWebView view, ICordovaClientCertRequest request) {
    if (mCertificates == null || mPrivateKey == null) {
        loadKeys(request);
    } else {
        proceedRequers(request);
    }
    return true;
}
项目:cordova-client-cert-authentication    文件:ClientCertificateAuthentication.java   
public AliasCallback(Context context, ICordovaClientCertRequest request) {
    mRequest = request;
    mContext = context;
    mPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
}
项目:cordova-client-cert-authentication    文件:ClientCertificateAuthentication.java   
public void proceedRequers(ICordovaClientCertRequest request) {
    request.proceed(mPrivateKey, mCertificates);
}