Change in ovirt-engine-sdk-java[master]: sdk: Register only relevant auth schemes

juan.hernandez at redhat.com juan.hernandez at redhat.com
Fri Jul 24 08:13:40 UTC 2015


Juan Hernandez has submitted this change and it was merged.

Change subject: sdk: Register only relevant auth schemes
......................................................................


sdk: Register only relevant auth schemes

Currently the SDK uses the default set of authentication scheme
factories, but some of them can't be used even if the server supports
them because the SDK may not have the required credentials. For example,
the caller may have initialized the SDK activating Kerberos but without
providing a user name and password:

  Api api = new ApiBuilder()
    .url("https://...")
    .kerberos(true)
    .build();

This is completely normal. But the server may support both Kerberos and
Basic authentication, responding with the following headers:

  WWW-Authenticate: Negotiate
  WWW-Authenticate: Basic realm="My realm"

In this case the underying HTTP library will first try to use the
Negotiate authentication scheme, and if it fails (there is no TGT in the
Kerberos credentials cache, for example) it will try Basic. But basic
will not work because the SDK doesn't have any valid credentials, and
will actually generate a NPE.

To avoid this issue this patch changes the SDK so that it only registers
the authentication schemes it has credentials for.

Change-Id: Iaafc13d9128a6e6072dbf02e85f7a3eedc1af838
Bug-Url: https://bugzilla.redhat.com/1243337
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M sdk/Makefile
M sdk/src/main/java/org/ovirt/engine/sdk/web/ConnectionsPoolBuilder.java
2 files changed, 19 insertions(+), 3 deletions(-)

Approvals:
  Juan Hernandez: Verified; Looks good to me, approved; Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/43764
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaafc13d9128a6e6072dbf02e85f7a3eedc1af838
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine-sdk-java
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Ori Liel <oliel at redhat.com>
Gerrit-Reviewer: automation at ovirt.org



More information about the Engine-commits mailing list