Uploaded image for project: 'Hot Rod Native client'
  1. Hot Rod Native client
  2. HRCPP-393

Improve usability of the authorization API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.2.0.Final
    • 8.2.0.Alpha1
    • .NET
    • None

      Currently this code is required to authenticate with the C# client:

                  AuthenticationStringCallback cbUser = new AuthenticationStringCallback(user);
                  AuthenticationStringCallback cbPass = new AuthenticationStringCallback(password);
                  AuthenticationStringCallback cbRealm = new AuthenticationStringCallback(REALM);
                  IDictionary<int, AuthenticationStringCallback> cbMap = new Dictionary<int, AuthenticationStringCallback>();
                  cbMap.Add((int)SaslCallbackId.SASL_CB_USER, cbUser);
                  cbMap.Add((int)SaslCallbackId.SASL_CB_PASS, cbPass);
                  cbMap.Add((int)SaslCallbackId.SASL_CB_GETREALM, cbRealm);
                  conf.Security().Authentication()
                                      .Enable()
                                      .SaslMechanism(GetMech())
                                      .SetupCallback(cbMap);
      

      Whereas, the Java client requires something like this:

            clientConfigurationBuilder.security()
               .authentication()
               .enable()
               .saslMechanism("CRAM-MD5")
               .callbackHandler(new TestCallbackHandler("user", "realm", "password".toCharArray()));
      

      Which is a lot simpler. Is there any way to improve the usability of this API? Could the CallBackHandler deal with some of this complexity instead?

            vrigamon@redhat.com Vittorio Rigamonti
            rhn-support-afield Alan Field
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: