Exemplo n.º 1
0
  @Override
  public boolean OnVerifiyCertificate(String subject, String issuer, String fingerprint) {

    // see if global settings says accept all
    if (GlobalSettings.getAcceptAllCertificates()) return true;

    // this is where the return code of our dialog will be stored
    callbackDialogResult = false;

    // set message
    String msg = getResources().getString(R.string.dlg_msg_verify_certificate);
    msg = msg + "\n\nSubject: " + subject + "\nIssuer: " + issuer + "\nFingerprint: " + fingerprint;
    dlgVerifyCertificate.setMessage(msg);

    // start dialog in UI thread
    uiHandler.sendMessage(Message.obtain(null, UIHandler.SHOW_DIALOG, dlgVerifyCertificate));

    // wait for result
    try {
      synchronized (dlgVerifyCertificate) {
        dlgVerifyCertificate.wait();
      }
    } catch (InterruptedException e) {
    }

    return callbackDialogResult;
  }
Exemplo n.º 2
0
  @Override
  public boolean OnAuthenticate(
      StringBuilder username, StringBuilder domain, StringBuilder password) {
    // this is where the return code of our dialog will be stored
    callbackDialogResult = false;

    // set text fields
    ((EditText) userCredView.findViewById(R.id.editTextUsername)).setText(username);
    ((EditText) userCredView.findViewById(R.id.editTextDomain)).setText(domain);
    ((EditText) userCredView.findViewById(R.id.editTextPassword)).setText(password);

    // start dialog in UI thread
    uiHandler.sendMessage(Message.obtain(null, UIHandler.SHOW_DIALOG, dlgUserCredentials));

    // wait for result
    try {
      synchronized (dlgUserCredentials) {
        dlgUserCredentials.wait();
      }
    } catch (InterruptedException e) {
    }

    // clear buffers
    username.setLength(0);
    domain.setLength(0);
    password.setLength(0);

    // read back user credentials
    username.append(
        ((EditText) userCredView.findViewById(R.id.editTextUsername)).getText().toString());
    domain.append(((EditText) userCredView.findViewById(R.id.editTextDomain)).getText().toString());
    password.append(
        ((EditText) userCredView.findViewById(R.id.editTextPassword)).getText().toString());

    return callbackDialogResult;
  }