@Override
      public void handle(Callback[] callbacks)
          throws UnsupportedCallbackException {
        NameCallback nc = null;
        PasswordCallback pc = null;
        RealmCallback rc = null;
        for (Callback callback : callbacks) {
          if (callback instanceof RealmChoiceCallback) {
            continue;
          } else if (callback instanceof NameCallback) {
            nc = (NameCallback) callback;
          } else if (callback instanceof PasswordCallback) {
            pc = (PasswordCallback) callback;
          } else if (callback instanceof RealmCallback) {
            rc = (RealmCallback) callback;
          } else {
            throw new UnsupportedCallbackException(callback,
                "Unrecognized SASL client callback");
          }
        }
        if (nc != null) {
          LOG.debug("SASL client callback: setting username: {}", userName);
          nc.setName(userName);
        }
        if (pc != null) {
          LOG.debug("SASL client callback: setting userPassword");
          pc.setPassword(userPassword);
        }
        if (rc != null) {
          LOG.debug("SASL client callback: setting realm: {}",
              rc.getDefaultText());
          rc.setText(rc.getDefaultText());
        }
      }
Create a client-side SASL transport that wraps an underlying transport.

@param methodStr The authentication method to use. Currently only KERBEROS is
              supported.
@param principalConfig The Kerberos principal of the target server.
@param underlyingTransport The underlying transport mechanism, usually a TSocket.
@param saslProps the sasl properties to create the client with
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/security/HadoopThriftAuthBridge.java