-
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
Optimize OIDC tenant id resolution #39492
Optimize OIDC tenant id resolution #39492
Conversation
6b35def
to
39960a9
Compare
39960a9
to
0a58003
Compare
@michalvavrik I've updated tests now to verify that the tenant config resolver is called only during the first request or when the session cookie resolves the tenant with the resolver choosing to let this tenant id stay (this is what I wanted to retain, to let the resolvers block the possibly bogus tenant ids on some paths), as well as added log messages which can help tracing how exactly the tenant id has been set. |
Status for workflow
|
Proposing a backport to 3.8 if possible since otherwise custom |
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.
looks very good
Thanks @michalvavrik. The PR is primarily about avoiding calling custom OIDC |
Thanks @gastaldi |
@gsmet Hi, I proposed backports, but I've just noticed a related quickstart failure, I'll have a look and re-add the backport suggestions once I figure out what is wrong with that test |
@michalvavrik @gastaldi I'm removing the release breaking change, because using a shared session cookie path for more than one OIDC |
@@ -166,7 +180,11 @@ private TenantConfigContext getStaticTenantContext(RoutingContext context) { | |||
} | |||
|
|||
private String resolveStaticTenantId(RoutingContext context) { | |||
String tenantId; | |||
String tenantId = context.get(OidcUtils.TENANT_ID_ATTRIBUTE); | |||
if (isTenantSetByAnnotation(context, tenantId)) { |
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.
@sberyozkin you changed the order of resolvers. Annotation-based should be behind tenantResolver
according to the https://quarkus.io/version/main/guides/security-openid-connect-multitenancy#static-tenant-resolution. I remember this change was discussed, but effectively documented order is different now?
I am asking because I did some tweaks to this code and need to know if this order should be kept now. I think it's fine, we just should change docs. Your call.
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 Sure, somewhere, as part of discussing this issue, I suggested the annotation based resolution check should be made before asking the custom resolvers to do the work, I'll tweak the docs
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.
Thank you, I wasn't sure.
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.
As otherwise it would defeat the purpose of using those annotations :-)
This doesn't apply cleanly so I will skip backporting. |
@gsmet OK, I'll have a look if it can work for 3.9.3 |
Fixes #39417
This requires some tests and actually setting the extra attribute during the annotation processing :-)