-
Notifications
You must be signed in to change notification settings - Fork 897
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
Add SQL store option to token store #14947
Add SQL store option to token store #14947
Conversation
693d1c1
to
c2b4ad0
Compare
@miq-bot rm-label wip |
c2b4ad0
to
dee0684
Compare
@gtanzillo @abellotti I've fleshed this out into something more workable. LMK what you think. Probably best reviewed ignoring whitespace. There were quite a few opportunities to refactor along the way with this one but I resisted as it is already quite large. You may see some further duplication added (e.g. the knowledge of how we serialize/deserialize data in sessions) along the way....because this PR is already quite large I think it would be best if I tackled that in a follow up. |
dee0684
to
752073b
Compare
Unless I'm mistaken, isn't this what https://github.com/rails/activerecord-session_store does? Can't you utilize that instead? |
(we already use it in the project, I mean) |
@chrisarcand we do.....but that doesn't have an abstraction layer at the level we need. It just provides an adapter for action dispatch which interacts directly with the model. The token store code is coupled to this interface, which the other adapters provide, so I'm adding an adapter for that here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@gtanzillo @abellotti any feedback on this? It's currently red only because brakeman doesn't like the |
The setting of this data is not exposed to the user - it's all handled internally by the token store. It should be safe to ignore this warning.
752073b
to
8715446
Compare
Some comments on commits imtayadeway/manageiq@24422a3~...8715446 spec/requests/api/authentication_spec.rb
|
Checked commits imtayadeway/manageiq@24422a3~...8715446 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/models/session.rb
lib/token_store/sql_store.rb
spec/lib/token_store/sql_store_spec.rb
|
@miq-bot add-label fine/yes |
@imtayadeway Is there a BZ for this? Can you please create if it doesn't exist? |
@simaishi here's the BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1459674 (hope I interpreted this correctly) |
…-store Add SQL store option to token store (cherry picked from commit ffd8972) https://bugzilla.redhat.com/show_bug.cgi?id=1460348
Fine backport details:
|
This does a
couple offew things:updated_on
valueThis is kind of a naive implementation that might have some issues. The most glaring is perhaps that we purge theSession
s based on a global ttl, meaning that this won't respect the ttl that is configured in the API/elsewhere, and that may not be easy to change. Opening this as a WIP to aid discussion@miq-bot add-label api, core, enhancement
@miq-bot assign @gtanzillo
Fixes #14882
Fixes https://www.pivotaltracker.com/story/show/130490379
/cc @martinpovolny