Hi Andrea,
I am using the following code snippet
String provider = "openstack-swift";
SwiftApi swiftApi = ContextBuilder.newBuilder(provider)
.endpoint("https://dal05.objectstorage.softlayer.net/auth/v1.0
")
.credentials("TENANT_NAME:USER_NAME", "API_KEY")
.modules(modules)
.buildApi(SwiftApi.class);
ContainerApi containerApi = swiftApi.getContainerApiForRegion("dal05");
Set<Container> containers = containerApi.list().toSet();
When I try this, I get the below exception
2014-10-17 09:59:19,302 [main] DEBUG SLF4JLogger Receiving response
-2004695267: HTTP/1.1 400 Bad Request
2014-10-17 09:59:19,308 DEBUG [jclouds.wire] [main] << "<html><h1>Bad
Request</h1><p>The server could not comply with the request since it is
either malformed or otherwise incorrect.</p></html>"
2014-10-17 09:59:19,308 [main] DEBUG SLF4JLogger << "<html><h1>Bad
Request</h1><p>The server could not comply with the request since it is
either malformed or otherwise incorrect.</p></html>"
org.jclouds.http.HttpResponseException: command: POST
https://dal05.objectstorage.softlayer.net/auth/v1.0/tokens HTTP/1.1 failed
with response: HTTP/1.1 400 Bad Request; content: [<html><h1>Bad
Request</h1><p>The server could not comply with the request since it is
either malformed or otherwise incorrect.</p></html>]
at
org.jclouds.openstack.swift.v1.handlers.SwiftErrorHandler.handleError(SwiftErrorHandler.java:46)
at
org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
at
org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:135)
at
org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:105)
at
org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:90)
at
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:73)
at
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:44)
at
org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
at
org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
at
com.sun.proxy.$Proxy100.authenticateWithTenantNameAndCredentials(Unknown
Source)
at
org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials.authenticateWithTenantName(AuthenticatePasswordCredentials.java:43)
at
org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials.authenticateWithTenantName(AuthenticatePasswordCredentials.java:31)
at
org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator.apply(BaseAuthenticator.java:79)
at
org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator.apply(BaseAuthenticator.java:36)
In the wire logs, I see it is a POST request with the following payload
"{"auth":{"
passwordCredentials":{"username":"USERID","password":"API_KEY"},"tenantName":"ACC-278436-15"}}"
However the actual api call should be a get with AUTH headers.
Thanks
Jai
On Fri, Oct 17, 2014 at 11:49 AM, Andrea Turli <[email protected]>
wrote:
> Hi Jai,
>
> please try with
>
> identity=tenantname:user
> credential=api_key
>
> Notice, you'll probably need to point at something like
>
> https://<locationId>.objectstorage.softlayer.net/auth/v1.0
>
> where locationId is something like `ams01` or `dal01`
>
> Best,
> Andrea
>
> On Fri, Oct 17, 2014 at 4:30 PM, Jai M <[email protected]> wrote:
> > I am using the openstack-swift api to interact with SoftLayer Object
> > storage. However the authentication is failing.
> >
> > I see the payload for the POST request to get the token is in the below
> > format
> >
> >
> "{"auth":{"passwordCredentials":{"username":"USERID","password":"API_KEY"},"tenantName":"ACC-278436-15"}}"
> >
> > This does not work for SL. The SL spec requires it to be a GET with
> headers
> >
> > "X-Auth-User: ACC-278436-15:USERID"
> > "X-Auth-Key: API_KEY"
> >
> > Is there a way I can switch/plugin a different authentication mechanism
> for
> > SoftLayer or should I use the blobstore api directly instead of swift
> api ?
> >
> > Let me know.
> >
> > Rgds
> > Jai
> >
> >
>