-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
OIDC: Encapsulate static/dynamic tenants maps in TenantConfigBean
#43007
Conversation
Thanks for your pull request! Your pull request does not follow our editorial rules. Could you have a look?
This message is automatically generated by a bot. |
This comment has been minimized.
This comment has been minimized.
🎊 PR Preview 47db797 has been successfully built and deployed to https://quarkus-pr-main-43007-preview.surge.sh/version/main/guides/
|
@snazy Thanks, can you fix the formatting please, I'll have a look tomorrow once I finish another PR |
0a6ab3c
to
3178a45
Compare
Sure, fixed |
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcConfig.java
Outdated
Show resolved
Hide resolved
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcConfig.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/DefaultTenantConfigResolver.java
Outdated
Show resolved
Hide resolved
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigBean.java
Outdated
Show resolved
Hide resolved
@snazy Thanks, it all looks good, refactoring makes sense and makes things a bit clearer. Michal, myself, added minor comments, but something did not work out during the initial refactoring, tests are impacted |
3178a45
to
6654e34
Compare
The issue that's fixed now is that |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Um - let me look into those new test failures |
6654e34
to
d0419b4
Compare
Hm - the tests in those projects don't fail locally |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Did you declare you have Linux containers available locally with |
Yup - just found those params in the GH workflow |
@snazy One thing I know is that even a single line update can have an impact there, a lot is going on with the tenant resolution, and this is why, having a bit of clean up and adding extra clarity would not be bad at all. It will help going forward, thanks for working on this PR.
|
Yea - something is quite broken with this change. Let me start from scratch. |
Thanks @snazy, yeah, I think the introduction of the functional interface is nice, and making sure static tenants are only recorded in the static map, is worth a dedicated PR of its own, so if you are OK with it, please do it first, and then complete the preparation with the 2nd PR focusing on the rest of your refactoring here |
Marked as a draft PR for now. |
Ah! I found out why the PR fails in the |
d0419b4
to
3764850
Compare
TenantConfigBean
Updated the PR entirely, focusing on moving the tenants-maps into the |
Note: Opened #43106 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
public Map<String, TenantConfigContext> getStaticTenantsConfig() { | ||
return staticTenantsConfig; | ||
public Uni<TenantConfigContext> createTenantContext(OidcTenantConfig oidcConfig, boolean dynamicTenant) { | ||
if (oidcConfig.logout.backchannel.path.isPresent()) { |
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.
dynamicTenant
is not checked yet
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.
Static tenants still escape into the dynamicTenants map in this PR.
I've opened #43110 to let static tenants not escape - tests should pass on 43110 now - the actual change wasn't that big - could actually sneak it back into this PR. WDYT?
if (tenantContext != null) { | ||
// Dynamic map may contain the static contexts initialized on demand, | ||
if (tenantConfigBean.getStaticTenantsConfig().containsKey(tenantId)) { | ||
if (tenantConfigBean.getStaticTenant(tenantId) != null) { |
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.
Please remove the comment above since it is no longer relevant
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.
#43110 removes it (the comment's still valid for this PR)
this.staticTenantsConfig = staticTenantsConfig; | ||
this.dynamicTenantsConfig = dynamicTenantsConfig; | ||
TenantContextFactory tenantContextFactory) { | ||
this.staticTenantsConfig = new ConcurrentHashMap<>(staticTenantsConfig); |
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.
It is not clear to me why it is now a concurrent map, given the dynamicTenant
in the function below is not checked
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.
#43110 should make it clear
Lets `TenantConfigBean` be the sole "owner" of the static/dynamic tenants maps, adds/changes accessor methods for tenants. Also introduces a functional interface to create tenants. No functional change, only moving code around. Also some minor code cleanups (reducing the amount of warnings in IntelliJ).
3764850
to
6b670ad
Compare
Status for workflow
|
Hi @snazy Can you please pickup the latest updates and rework this PR next week or so, to have access to the dynamic (and static) map encapsulated inside Now that the static tenant does not leak into the dynamic map anymore after a fix from @michalvavrik, the PR should become much simpler, Let me now please if you won't have much time, thanks. |
Closed in favor of #43590 |
Lets
TenantConfigBean
be the sole "owner" of the static/dynamic tenants maps, adds/changes accessor methods for tenants. Also introduces a functional interface to create tenants.No functional change, only moving code around.
Also some minor code cleanups (reducing the amount of warnings in IntelliJ).