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

[17.0][MIG] auth_api_key: Migration to 17.0. #591

Merged
merged 65 commits into from
Jan 26, 2024

Conversation

chrisb-c01
Copy link

No description provided.

lmignon and others added 30 commits December 16, 2023 15:13
Get rid of keychain dependency
Api key is now based on the new version of server env
Key belong to a specifiv database that can be requested based on the
domain name.

Just setup the db_filter with "%d^" to filter based on domain name
Add a migration script to create the auth.api.key records from keys defined into the cfg file
Provides a specific serction name builder to continue reading the key info from the same section as the one expected by the previous version
@chrisb-c01 chrisb-c01 mentioned this pull request Dec 16, 2023
19 tasks
@pedrobaeza
Copy link
Member

Isn't this a native feature since the integration of TOTP?

@chrisb-c01 chrisb-c01 force-pushed the 17.0-mig-auth_api_key branch from 538e178 to 19b09b4 Compare December 17, 2023 10:58
@chrisb-c01
Copy link
Author

Isn't this a native feature since the integration of TOTP?

Do you mean the ability for a user to generate an API key from their profile page? There is some overlap indeed, but imho there is still use for this addon.

  • You can (as an admin) centrally manage the API keys assigned to different users from the settings page.
  • Also having the auth='api_key' param on the controller allows you to permit authenticating using the API key but not just any user/password combination.

return self._retrieve_api_key(key).user_id.id

def _clear_key_cache(self):
self.env.registry.clear_cache()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests were failing before because clearing the orm cache using clear_cache() is not available anymore in 17.0 on the cache object. It was removed in this commit with the introduction of multiple caches. Needed to call env.registry.clear_cache() instead. Might be useful for other migrations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisb-c01 Thanks for the details!

@pedrobaeza
Copy link
Member

OK, IMO you should add that explanations to the README.

Copy link
Member

@FrancoMaxime FrancoMaxime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gurneyalex
Copy link
Member

/ocabot migration auth_api_key

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Jan 26, 2024
@gurneyalex
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 17.0-ocabot-merge-pr-591-by-gurneyalex-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 2e3b528 into OCA:17.0 Jan 26, 2024
4 of 6 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at cd9e49b. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.