nacx approved this pull request.

Just some small comments. Thanks for the contribution @axel3rd!

>        } else if (DOMAIN.equals(parts[0])) {
          return DomainScope.create(Name.create(parts[1]));
       } else {
          return DomainIdScope.create(Id.create(parts[1]));
       }
    }
+
+   private Object parseProjectDomain(TenantOrDomainAndCredentials<T> 
credentials, boolean useTenant) {

Do we really need this boolean `useTenant` flag? Could we just change 
precedence and check the new properties first, then fallback to the tenant ones?

>  
-      assertEquals(server.getRequestCount(), 1);
-      assertSent(server, "POST", "/auth/tokens", 
stringFromResource("/v3/auth-password-scoped.json"));
+   public void testAuthenticatePasswordProjectScopedNameDomainHack() throws 
InterruptedException {

`s/Hack/BackwardsCompat/` ?

> +   @SuppressWarnings("unchecked")
+   private void checkTokenResult(TenantOrDomainAndCredentials<?> credentials, 
String json) throws InterruptedException {
+      server.enqueue(jsonResponse("/v3/token.json"));
+
+      AuthInfo authInfo = null;
+
+      if (credentials.credentials() instanceof PasswordCredentials) {
+         authInfo = authenticationApi
+               
.authenticatePassword((TenantOrDomainAndCredentials<PasswordCredentials>) 
credentials);
+      } else if (credentials.credentials() instanceof TokenCredentials) {
+         authInfo = 
authenticationApi.authenticateToken((TenantOrDomainAndCredentials<TokenCredentials>)
 credentials);
+      } else if (credentials.credentials() instanceof ApiAccessKeyCredentials) 
{
+         authInfo = authenticationApi
+               
.authenticateAccessKey((TenantOrDomainAndCredentials<ApiAccessKeyCredentials>) 
credentials);
+      } else {
+         throw new InterruptedException(String.format("Unsupported 
authentication method with class: %s",

Better throw an `IllegalArgumentException`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1204#pullrequestreview-118240648

Reply via email to