javaopenstack-swiftjclouds

Can't Get Authenticate Swift ContextBuilder with Latest OpenStack


i have installed the latest OpenStack and I'm using Java and jclouds SDK to interact with OpenStack Swift, in the OpenStack environment that I'm using, the identity API version is /identity/v3/ and the Swift API version is v1/, my code is:

blobContext = ContextBuilder.newBuilder(PROVIDER)
        .credentials(username, apiKey)
        .endpoint(EndPoint)
        .overrides(multipartProperties)
        //.buildApi(RegionScopedBlobStoreContext.class);
        .buildView(RegionScopedBlobStoreContext.class);
String blobRegion = blobContext.getConfiguredRegions().iterator().next();

so at the line String blobRegion = blobContext.getConfiguredRegions().iterator().next(); i get the exception:

request: POST http://devstack.####.com:#####/v1/tokens HTTP/1.1  [Sensitive data in payload, use jclouds.wire.log.sensitive override to enable logging this data.] failed with response: HTTP/1.1 401 Unauthorized

this code used to work in the past, yet in the past i wasn't using the latest OpenStack and the important thing is that my identity service is Project-scoped not Domain-Scoped (refer to this link) and the swift API is: http://devstack.####.com:#####/v1/ and I'm using the latest jclouds API

and i believe this problem will appear in all ContextBuilders, so is there anyway that i can solve this issue?

Thanks


Solution

  • To use jclouds against new OpenStack environments (running Keystone v3) you must use jclouds >= 2.1.0 and configure the ContextBuilder with the appropriate Keystone properties as detailed here: https://jclouds.apache.org/blog/2018/01/16/keystone-v3/