You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Alix Lourme <no...@github.com> on 2018/05/07 16:07:41 UTC

[jclouds/jclouds] OpenStack Keystone V3 - different auth "domains" support (JCLOUDS-1414) (#1204)

Cf. [JCLOUDS-1414](https://issues.apache.org/jira/browse/JCLOUDS-1414)
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds/pull/1204

-- Commit Summary --

  * OpenStack Keystone V3 - different auth "domains" support (JCLOUDS-1414)

-- File Changes --

    M apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/domain/TenantOrDomainAndCredentials.java (6)
    M apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/functions/BaseAuthenticator.java (36)
    M apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/config/KeystoneProperties.java (32)
    M apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindAuthToJsonPayload.java (26)
    M apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Auth.java (73)
    M apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/auth/V3AuthenticationApiMockTest.java (130)
    A apis/openstack-keystone/src/test/resources/v3/auth-password-project-scoped-id-domain-id.json (26)
    A apis/openstack-keystone/src/test/resources/v3/auth-password-project-scoped-id-domain-name.json (26)
    A apis/openstack-keystone/src/test/resources/v3/auth-password-project-scoped-name-domain-hack.json (26)
    A apis/openstack-keystone/src/test/resources/v3/auth-password-project-scoped-name-domain-id.json (26)
    A apis/openstack-keystone/src/test/resources/v3/auth-password-project-scoped-name-domain-name.json (26)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/1204.patch
https://github.com/jclouds/jclouds/pull/1204.diff

-- 
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

Re: [jclouds/jclouds] OpenStack Keystone V3 - different auth "domains" support (JCLOUDS-1414) (#1204)

Posted by Ignasi Barrera <no...@github.com>.
Pushed to [master](http://git-wip-us.apache.org/repos/asf/jclouds/commit/053dfd01) and [2.1.x](http://git-wip-us.apache.org/repos/asf/jclouds/commit/93a805ca). Thanks @axel3rd!

-- 
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#issuecomment-387994482

Re: [jclouds/jclouds] OpenStack Keystone V3 - different auth "domains" support (JCLOUDS-1414) (#1204)

Posted by Ignasi Barrera <no...@github.com>.
Closed #1204.

-- 
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#event-1619345086

Re: [jclouds/jclouds] OpenStack Keystone V3 - different auth "domains" support (JCLOUDS-1414) (#1204)

Posted by Alix Lourme <no...@github.com>.
@nacx : I will do that (your reviews, thanks) this wednesday. About `useTenant` flag I will be more explicit and add a unit test to prove the use case.

-- 
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#issuecomment-387494176

Re: [jclouds/jclouds] OpenStack Keystone V3 - different auth "domains" support (JCLOUDS-1414) (#1204)

Posted by Ignasi Barrera <no...@github.com>.
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

Re: [jclouds/jclouds] OpenStack Keystone V3 - different auth "domains" support (JCLOUDS-1414) (#1204)

Posted by Alix Lourme <no...@github.com>.
axel3rd commented on this pull request.



>        } 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) {

For project/id, there is [currently](https://github.com/jclouds/jclouds/blob/master/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindAuthToJsonPayload.java#L100) no domain created on tenant properties => it was more for backwardcompatibility (use new properties only for project/id, both for project/name).

-- 
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#discussion_r186698942

Re: [jclouds/jclouds] OpenStack Keystone V3 - different auth "domains" support (JCLOUDS-1414) (#1204)

Posted by Alix Lourme <no...@github.com>.
> I will do that (your reviews, thanks) this wednesday. About useTenant flag I will be more explicit and add a unit test to prove the use case.

Done, with `useTenant` renamed with [some explanation](https://github.com/jclouds/jclouds/pull/1204/files#diff-918e1e161307a179875339dfa9caceedR109), with [dedicated unit test](https://github.com/jclouds/jclouds/pull/1204/files#diff-59311ec5e3d12e89d93b3e4bf1dc805dR52) for backwards compatibility.
Available for any review complement(s).

-- 
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#issuecomment-387766478