Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Identity v2 AuthOptionsBuilder #2651

Open
cardoe opened this issue Jun 21, 2023 · 3 comments · May be fixed by #2655
Open

use Identity v2 AuthOptionsBuilder #2651

cardoe opened this issue Jun 21, 2023 · 3 comments · May be fixed by #2655
Assignees

Comments

@cardoe
Copy link
Contributor

cardoe commented Jun 21, 2023

So for Identity v3, gophercloud takes in an AuthOptionsBuilder from the token3 which ensures that the data to authenticate with will conform to the Identity v3 APIs. This allows people to implement their own custom auth mechanisms like exist in the Python ecosystem which is great. This same support/ecosystem exists for Identity v2. In fact gophercloud originated from https://github.com/rackspace/gophercloud which has their own Identity v2 auth mechanism using an "API key". When gophercloud moved from under the Rackspace umbrella it rightfully removed all the "Rackspace-isms", however there's no mechanism by which to add this back.

I'm proposing using tokens2.AuthOptionsBuilder similar to how the Identity v3 auth works in gophercloud. This would improve #1330. However I'm aware of #2577 wanting to remove Identity v2 support, however Rackspace is still using Identity v2. I'd like to get Rackspace contributing more to gophercloud and using it more in the future.

As a first attempt of getting Rackspace to use upstream gophercloud I implemented os-pc/cloud-provider-rackspace@56cf8a1#diff-b5b02d252ffde072fea7841ee6419db056b027d7f365193f0d33fad8294ffedc but I've now seen how the interfaces can be used and implemented and will improve it.

cardoe added a commit to cardoe/gophercloud that referenced this issue Jun 22, 2023
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The
gophercloud.AuthOptions already implements this interface so there is no
change to the API and no functional change for stock gophercloud usage
but it would allow others to implement their own identity v2
authentication schemes. fixes gophercloud#2651.
cardoe added a commit to cardoe/gophercloud that referenced this issue Jun 22, 2023
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The interface is
modified to add a CanReauth function like the v3 version has but
provides a default implementation. The gophercloud.AuthOptions already
implements this interface so there is no change to its API. Lastly add
an AuthenticateV2Ext function which will allow an out of tree identity
v2 auth mechanism to be implemented. fixes gophercloud#2651.
cardoe added a commit to cardoe/gophercloud that referenced this issue Jun 22, 2023
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The interface is
modified to add a CanReauth function like the v3 version has but
provides a default implementation. The gophercloud.AuthOptions already
implements this interface so there is no change to its API. Lastly add
an AuthenticateV2Ext function which will allow an out of tree identity
v2 auth mechanism to be implemented. fixes gophercloud#2651. ref gophercloud#1330.
@cardoe cardoe linked a pull request Jun 22, 2023 that will close this issue
@mandre
Copy link
Contributor

mandre commented Jun 30, 2023

If Rackspace is still using identity v2, I don't see a problem leaving it in gophercloud, unless of course, you're looking for an excuse to speed up the adoption of v3 😄

@pierreprinetti
Copy link
Contributor

Hi @cardoe ! Thank you for this contribution. I particularly appreciate the rationale behind it.

I could give this PR a brief look and I think it would be a nice addition to Gophercloud to accept an interface rather than a bare type for the auth v2 options, so that users have more room to support different methods.

I am going to review this PR in detail next week.

@pierreprinetti pierreprinetti self-assigned this Jun 30, 2023
@cardoe
Copy link
Contributor Author

cardoe commented Jun 30, 2023

Thanks for the review @pierreprinetti. @mandre I'd love to have Rackspace adopt identity v3 however I think that's still a ways off. Dropping identity v2 won't make them speed up adopting v3.

I used this PR to implement Rackspace auth in a PR to clean up my original implementation. The PR for that is os-pc/cloud-provider-rackspace#13 but it's a bit ugly to follow. I can make a gist as an example. I'm also willing to update any gophercloud docs to give examples of how to implement different auth types much like the examples that the Python keystoneauth package provides if you link me to the relevant docs repo.

cardoe added a commit to cardoe/gophercloud that referenced this issue Apr 13, 2024
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The interface is
modified to add a CanReauth function like the v3 version has but
provides a default implementation. The gophercloud.AuthOptions already
implements this interface so there is no change to its API. This will
allow an out of tree identity v2 auth mechanism to be implemented,
just like the v3. fixes gophercloud#2651. ref gophercloud#1330.
cardoe added a commit to cardoe/gophercloud that referenced this issue Apr 14, 2024
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The interface is
modified to add a CanReauth function like the v3 version has but
provides a default implementation. The gophercloud.AuthOptions already
implements this interface so there is no change to its API. This will
allow an out of tree identity v2 auth mechanism to be implemented,
just like the v3. fixes gophercloud#2651. ref gophercloud#1330.
cardoe added a commit to cardoe/gophercloud that referenced this issue Apr 14, 2024
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The interface is
modified to add a CanReauth function like the v3 version has but
provides a default implementation. The gophercloud.AuthOptions already
implements this interface so there is no change to its API. This will
allow an out of tree identity v2 auth mechanism to be implemented,
just like the v3. fixes gophercloud#2651. ref gophercloud#1330.
cardoe added a commit to cardoe/gophercloud that referenced this issue Apr 14, 2024
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The interface is
modified to add a CanReauth function like the v3 version has but
provides a default implementation. The gophercloud.AuthOptions already
implements this interface so there is no change to its API. This will
allow an out of tree identity v2 auth mechanism to be implemented,
just like the v3. fixes gophercloud#2651. ref gophercloud#1330.
cardoe added a commit to cardoe/gophercloud that referenced this issue Apr 14, 2024
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The interface is
modified to add a CanReauth function like the v3 version has but
provides a default implementation. The gophercloud.AuthOptions already
implements this interface so there is no change to its API. This will
allow an out of tree identity v2 auth mechanism to be implemented,
just like the v3. fixes gophercloud#2651. ref gophercloud#1330.
cardoe added a commit to cardoe/gophercloud that referenced this issue Apr 14, 2024
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The interface is
modified to add a CanReauth function like the v3 version has but
provides a default implementation. The gophercloud.AuthOptions already
implements this interface so there is no change to its API. This will
allow an out of tree identity v2 auth mechanism to be implemented,
just like the v3. fixes gophercloud#2651. ref gophercloud#1330.
cardoe added a commit to cardoe/gophercloud that referenced this issue Apr 14, 2024
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The
gophercloud.AuthOptions already implements this interface so there
is no change to the API. To avoid any API change, add
AuthenticateV2Ext() as a version of AuthenticateV2() accepting the
interface. This will allow an out of tree identity v2 auth mechanism
to be implemented, just like the v3. fixes gophercloud#2651. ref gophercloud#1330.
pierreprinetti pushed a commit to shiftstack/gophercloud that referenced this issue May 16, 2024
Rather than creating a tokens2.AuthOptions inside the authentication
flow for identity v2, allow any structure that implements the
tokens2.AuthBuilderOptions interface to be used. The interface is
modified to add a CanReauth function like the v3 version has but
provides a default implementation. The gophercloud.AuthOptions already
implements this interface so there is no change to its API. This will
allow an out of tree identity v2 auth mechanism to be implemented,
just like the v3. fixes gophercloud#2651. ref gophercloud#1330.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants