-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Introduce OIDC Database Token State Manager extension #36175
Introduce OIDC Database Token State Manager extension #36175
Conversation
Thanks for your pull request! The title of your pull request does not follow our editorial rules. Could you have a look?
This message is automatically generated by a bot. |
2b4e25d
to
cd8f70f
Compare
🙈 The PR is closed and the preview is expired. |
This comment has been minimized.
This comment has been minimized.
Wow, these failures by name seems very much related, though I only extracted 2 methods from OIDC module. I'm going to check today how that could result in this. |
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java
Outdated
Show resolved
Hide resolved
Hey @michalvavrik Thanks for preparing this new feature 👍 , a few tests are failing :-), but I think they'll get green as I believe you don't need to change anything in the default token manager, there is nothing to secure in the cookie value returned from the DB one - tokens are secured in the DB. I'll prepare an email to the quarkus-dev with some justifications for the new feature Thanks |
96dbeff
to
ec784fc
Compare
This comment has been minimized.
This comment has been minimized.
Is it a 30/70% PR review state or aimed ot be merged? If the latter,m I'd love ot see the doc changes and how we plan to expose that to users. |
I'll let @sberyozkin answer, I suppose Sergey will review when he has time. Only thing I know about now is that I have one unused property in recorder that I plan to remove when someone requires any changes at all. |
...ava/io/quarkus/oidc/db/token/state/manager/runtime/OidcDbTokenStateManagerRunTimeConfig.java
Outdated
Show resolved
Hide resolved
...ava/io/quarkus/oidc/db/token/state/manager/runtime/OidcDbTokenStateManagerRunTimeConfig.java
Show resolved
Hide resolved
...ava/io/quarkus/oidc/db/token/state/manager/runtime/OidcDbTokenStateManagerRunTimeConfig.java
Show resolved
Hide resolved
HI @emmanuelbernard @michalvavrik, indeed, update to the https://quarkus.io/guides/security-oidc-code-flow-authentication#handling-and-controlling-the-lifetime-of-authentication, should be part of the PR. Michal, I believe we just need to add another subsection there, probably named |
ec784fc
to
6fcd247
Compare
f58ad43
to
3bb9fd1
Compare
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.
@michalvavrik It looks perfect. Thanks for updating JavaDocs for DefaultTokenStateManager too along the way 👍 , thanks
This comment has been minimized.
This comment has been minimized.
Hi @yrodiere, can you please check a few of DB related classes in this PR, overall, the idea is to let uses persist 3 OIDC tokens (ID, access, refresh) in DB, query them, and remove, on demand and with a scheduled removal of expired entries. The code in the Thanks |
...main/java/io/quarkus/oidc/db/token/state/manager/OidcDbTokenStateManagerBuildTimeConfig.java
Outdated
Show resolved
Hide resolved
...ava/io/quarkus/oidc/db/token/state/manager/runtime/OidcDbTokenStateManagerRunTimeConfig.java
Outdated
Show resolved
Hide resolved
...me/src/main/java/io/quarkus/oidc/db/token/state/manager/runtime/OidcDbTokenStateManager.java
Outdated
Show resolved
Hide resolved
.../java/io/quarkus/oidc/db/token/state/manager/runtime/OidcDbTokenStateManagerInitializer.java
Show resolved
Hide resolved
.../java/io/quarkus/oidc/db/token/state/manager/runtime/OidcDbTokenStateManagerInitializer.java
Show resolved
Hide resolved
Hey, this seems to use the reactive SQL clients, and unfortunately I know as little as you do in that area, probably less :) It's probably better to ask @tsegismont :) EDIT: But FWIW I agree with the decision not to use Hibernate ORM or Hibernate Reactive here, as it would certainly cause trouble for application developers, and #13425 is only one of them. |
Thanks for the feedback @yrodiere and also for giving your support to the @michalvavrik's design decision :-). Overall, the DB related code is very simple, even I can understand it :-), I'd just like to have an expert to have a quick look, @tsegismont, if you can find a few mins to have a look it would be great, should not take much time, thanks |
3bb9fd1
to
0c1f591
Compare
Failing Jobs - Building 0c1f591
Full information is available in the Build summary check run. Failures⚙️ JVM Tests - JDK 20 #- Failing: extensions/hibernate-orm/deployment integration-tests/virtual-threads/mailer-virtual-threads
! Skipped: extensions/flyway/deployment extensions/hibernate-envers/deployment extensions/hibernate-reactive/deployment and 103 more 📦 extensions/hibernate-orm/deployment✖
📦 integration-tests/virtual-threads/mailer-virtual-threads✖
|
@michalvavrik I think I'm going to merge it soon enough, as I said the DB code is straightforward, a basic entity is saved/retrieved. But we'll see what users will report and tune whatever will be required - I guess it is hard to spot any problem until users actually start stressing it. Overall it is comprehensively tested |
Thanks @sberyozkin . This morning I was actually looking for additional reviewers, but I didn't see between contributor to this reactive client anyone more fit than people you already asked . I can imagine some optimalization there could be, but it should be safe code anyway (also we have tests). |
This doc build failure was not here the previous time and I've seen it happening sometimes |
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.
@michalvavrik @sberyozkin sorry for the late reply
The OidcDbTokenStateManagerInitializer
looks good to me. Perhaps it can be simplified a bit by not using mutiny (not useful here), but it's only a matter of readability.
.../java/io/quarkus/oidc/db/token/state/manager/runtime/OidcDbTokenStateManagerInitializer.java
Show resolved
Hide resolved
I agree, fix is already merged here #36366. |
I'll add it to my list and address it eventually, frankly using Mutiny was simpler to me as I'm used to it (it's pretty much omnipresent in Quarkus). Thanks for your feedback @tsegismont . |
closes: #13239
New extension uses the Reactive SQL clients to store and retrieve tokens in a database, instead of storing them in a session cookie (which is default behavior). Currently Hibernate ORM and Hibernate Reactive doesn't work together, which means I could not leverage Hibernate Reactive, for the most applications are likely to use the Hibernate ORM extension directly. On the other hand, basing this on JDBC driver and block during authentication seems like a very bad design, because it would lead to thread switching. I don't think we should provide something so wrong (blocking auth), users can always write it themselves if necessary. As far as suggestion to use Panache goes, I also think it's not suitable (1. Hibernate Reactive vs ORM, 2. multitenancy is not supported).