Changing OidcTenantConfig returned from TenantConfigResolver::resolve has no effect #48199
-
We're using Quarkus 3.20.0 and a multi-tenant dynamic Oidc setup. As the title says, when returning OidcTenantConfig in TenantConfigResolver::resolve for a tenant with a changed property (e.g. clientId), the changed property seems to be ignored and the initial value is still being used by Quarkus. Is this the intented behavior or is it a bug? Br |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
/cc @pedroigor (oidc), @radcortez (config), @sberyozkin (oidc) |
Beta Was this translation helpful? Give feedback.
-
@maag03 We haven't looked into dealing with such cases, where an already resolved configuration (and therefore, possibly the config related to the already OIDC provider connection) has been updated. Can you clarify please, is your use case about specifically the client secret recycling/update for the existing OIDC session ? The challenge is how to handle correctly a case where an already resolved configuration does not match the newly resolved configuration for the current OIDC tenant - it may require just a swap or re-establishing the connection. Perhaps we can start with taking care of the client secret update only as it is a known use case. @michalvavrik This is the kind of challenge I thought should be discussed in detail, I'm referring here to my comments to your previous PRs. |
Beta Was this translation helpful? Give feedback.
-
It is also possible to register I've looked at the code, if the client id and secret are sent as form parameters, then this provider is called on every request. but not if the client id and secret are sent as the Basic authorization scheme value. So if the client secret post authentication is an option, it will offer a workaround, where your CredentialProvider will cache the current secret and replace it once the updated value is available. I'll look into treating it consistently between client_secret_basic and client_secret_post (either read the secret once from the provider in both cases, or call the provider on every request) |
Beta Was this translation helpful? Give feedback.
-
We have a couple of different use cases, e.g. misconfiguration, changing clientIds, keys for JWTs, URLs etc. In previous versions of Quarkus we could use: You might also wonder why TenantConfigResolver::resolve is being called upon repeatedly when it has no effect for a already resolved tenant? |
Beta Was this translation helpful? Give feedback.
@maag03 Do you mean why it is called when the session is already available ? I recall this case, to let resolvers react to a situation where the call with the existing session tries to reach the space covered by another tenant. Resolvers will see the tenant id attribute on the routing context when the session already exists and can return null if the tenant id is correct for a given request url.
As far as `remove' is concerned, the idea was to encapsulate the tenant management.
But I see it caused problems in your case.
I think may be this is what we should do, if the returned config instance is not null and not the same as the already resolved one, we just remove internally the original …