corrected keystone parsing and default url for hp cloud storage

This commit is contained in:
Adrian Cole 2012-02-09 17:54:06 +00:00
parent ad724de243
commit 567f845444
3 changed files with 12 additions and 13 deletions

View File

@ -18,6 +18,8 @@
*/
package org.jclouds.openstack.keystone.v2_0.functions;
import static com.google.common.base.Preconditions.checkArgument;
import javax.inject.Inject;
import javax.inject.Singleton;
@ -27,8 +29,6 @@ import org.jclouds.openstack.keystone.v2_0.domain.Access;
import org.jclouds.openstack.keystone.v2_0.domain.ApiAccessKeyCredentials;
import com.google.common.base.Function;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
@Singleton
public class AuthenticateApiAccessKeyCredentials implements Function<Credentials, Access> {
@ -41,10 +41,10 @@ public class AuthenticateApiAccessKeyCredentials implements Function<Credentials
@Override
public Access apply(Credentials input) {
// TODO: tenantID may not be present
Iterable<String> tenantIdUsernameOrAccessKey = Splitter.on(':').split(input.identity);
String tenantId = Iterables.get(tenantIdUsernameOrAccessKey, 0);
String usernameOrAccessKey = Iterables.get(tenantIdUsernameOrAccessKey, 1);
checkArgument(input.identity.indexOf(':') != -1, "format is tenantId:accesskey");
String tenantId = input.identity.substring(0, input.identity.indexOf(':'));
String usernameOrAccessKey = input.identity.substring(input.identity.indexOf(':') + 1);
String passwordOrSecretKey = input.credential;
ApiAccessKeyCredentials apiAccessKeyCredentials = ApiAccessKeyCredentials.createWithAccessKeyAndSecretKey(

View File

@ -17,6 +17,7 @@
* under the License.
*/
package org.jclouds.openstack.keystone.v2_0.functions;
import static com.google.common.base.Preconditions.checkArgument;
import javax.inject.Inject;
@ -26,8 +27,6 @@ import org.jclouds.openstack.keystone.v2_0.domain.Access;
import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials;
import com.google.common.base.Function;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
public class AuthenticatePasswordCredentials implements Function<Credentials, Access> {
private final ServiceClient client;
@ -39,10 +38,10 @@ public class AuthenticatePasswordCredentials implements Function<Credentials, Ac
@Override
public Access apply(Credentials input) {
// TODO: tenantID may not be present
Iterable<String> tenantIdUsernameOrAccessKey = Splitter.on(':').split(input.identity);
String tenantId = Iterables.get(tenantIdUsernameOrAccessKey, 0);
String usernameOrAccessKey = Iterables.get(tenantIdUsernameOrAccessKey, 1);
checkArgument(input.identity.indexOf(':') != -1, "format is tenantId:accesskey");
String tenantId = input.identity.substring(0, input.identity.indexOf(':'));
String usernameOrAccessKey = input.identity.substring(input.identity.indexOf(':') + 1);
String passwordOrSecretKey = input.credential;
PasswordCredentials passwordCredentials = PasswordCredentials.createWithUsernameAndPassword(usernameOrAccessKey,

View File

@ -35,7 +35,7 @@
<properties>
<test.initializer>org.jclouds.hpcloud.objectstorage.lvs.blobstore.integration.HPCloudObjectStorageLasVegasTestInitializer</test.initializer>
<test.hpcloud-objectstorage-lvs.endpoint>https://region-a.geo-1.objects.hpcloudsvc.com/auth</test.hpcloud-objectstorage-lvs.endpoint>
<test.hpcloud-objectstorage-lvs.endpoint>https://region-a.geo-1.identity.hpcloudsvc.com:35357</test.hpcloud-objectstorage-lvs.endpoint>
<test.hpcloud-objectstorage-lvs.api-version>1.0</test.hpcloud-objectstorage-lvs.api-version>
<test.hpcloud-objectstorage-lvs.build-version></test.hpcloud-objectstorage-lvs.build-version>
<test.hpcloud-objectstorage-lvs.identity>FIXME_IDENTITY</test.hpcloud-objectstorage-lvs.identity>