-
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
Add quarkus-oidc-client-registration extension #41866
Add quarkus-oidc-client-registration extension #41866
Conversation
This comment has been minimized.
This comment has been minimized.
5f85d2e
to
4a13c45
Compare
This comment has been minimized.
This comment has been minimized.
fa1b720
to
1993ec4
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.
Looks good overall, added some nice-to-have suggestions
docs/src/main/asciidoc/security-openid-connect-client-registration.adoc
Outdated
Show resolved
Hide resolved
...va/io/quarkus/oidc/client/registration/deployment/OidcClientRegistrationBuildTimeConfig.java
Show resolved
Hide resolved
.../runtime/src/main/java/io/quarkus/oidc/client/registration/OidcClientRegistrationConfig.java
Show resolved
Hide resolved
...ava/io/quarkus/oidc/client/registration/runtime/DisabledOidcClientRegistrationException.java
Show resolved
Hide resolved
.../main/java/io/quarkus/oidc/client/registration/runtime/OidcClientConfigurationException.java
Outdated
Show resolved
Hide resolved
...c/main/java/io/quarkus/oidc/client/registration/runtime/OidcClientRegistrationException.java
Show resolved
Hide resolved
...me/src/main/java/io/quarkus/oidc/client/registration/runtime/OidcClientRegistrationImpl.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
Hey @gastaldi Thanks for finding the time yesterday :-), I switched off my laptop shortly after I opened the PR. I'll handle some of the comments, but as far as |
This comment has been minimized.
This comment has been minimized.
5be254e
to
aaae917
Compare
This comment has been minimized.
This comment has been minimized.
@michalvavrik, what are your thoughts about an order in which This PR introduces I don't mind much waiting for #39185 before finalizing this PR but completing #39815 may take a while and it would be more difficult afterwards to move some of the builder API support for If that works for you, then, once everyone is happy with this PR, two of us can look at introducing the builder API for |
Hey @pedroigor @gastaldi, I've temporarily moved it to Draft to look at tests till the end of the week, as I have to sign off. So, the main remaining issue, as far as I see, is what can be done with the already registered clients after a restart, to avoid reregistering them again. The first thing I've tried is to check what Keycloak does if the new client metadata contain the client name and the client with the same name has already been registered. Right now, indeed, Keycloak, would just keep creating new clients, they would all have unique ids but the same name. I've opened keycloak/keycloak#32133 with some proposals how to avoid such duplications. However, I'm not 100% sure the team will agree, and the other thing is that as far as the OIDC dynamic reg spec is concerned, it is all totally undefined as to what happens in such cases, so even if we optimize it for Keycloak, the duplication may be still happening for other providers. So, the only thing I could think of is to let users postpone such pre configured client registration until the runtime, so that they can get a chance to restore the already registered client's metadata. To do so, the users would have to persist It is getting quite complex though so my proposal would be to give users a chance to start experimenting with all the options once I get the PR green. Will ping a bit later |
🙈 The PR is closed and the preview is expired. |
a84b392
to
fb848ad
Compare
I've fixed the tests and added new content to the docs, showing a simple example of how an already registered client can read its own metadata, ex, when it needs to refresh it and I'll try update with Keycloak 25.0.3 or later. More importantly, I've added one more doc section suggesting a strategy for avoiding the duplicate client registrations at startup in cases when client metadata are preconfigured:
Other good ideas from Pedro, 1) support named Thanks |
This comment has been minimized.
This comment has been minimized.
fb848ad
to
3578b03
Compare
This comment has been minimized.
This comment has been minimized.
3578b03
to
1605699
Compare
Hey @pedroigor @gastaldi With Keycloak 25.0.4, I was able to update the test to show the individual registered client's update also works, see the code starting from here. So we check there first that the registered client's name is That should get enough space for users to start experimenting. The extension is clearly marked as experimental even in the docs, so we'll have an easy way to tune the API for a while. Once this one is merged, I'll open follow up enhancement requests: named OidcClientRegistration injection, and closer integration with |
This comment has been minimized.
This comment has been minimized.
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.
LGTM
...me/src/main/java/io/quarkus/oidc/client/registration/runtime/OidcClientRegistrationImpl.java
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
1605699
to
36d84b4
Compare
Status for workflow
|
Status for workflow
|
I'm getting ready to merge it, as Pedro may not have time. I'll definitely though follow up with enhancement requests based on Pedro's feedback. In the very short term I'd like users to try it and I think I may need to tweak ClientMetadata a bit to make it easier to avoid having to deal with JSON and let users add array properties to the builder, etc. It is too complex now to keep adding new things to it at the moment IMHO :-) |
Hi @michalvavrik That was fixed in response to #43106 |
it was fixed here #42947, nevertheless, it works. thanks for the fix |
Fixes #38250.
This PR introduces
experimental
quarkus-oidc-client-registration
extension to support OIDC Dynamic Client Registration. Client registration API provided by this extension may change after feedback from users, before it settles down.OIDC Dynamic Client Registration is an important feature allowing to scale up registration and management of OIDC clients in combination with dynamic OIDC tenancy resolution.
I'm moving it out of the draft state because this PR is no longer trying to bring 2 new extensions (
quarkus-oidc-client-registration
,quarkus-oidc-client-registration-configuration-source
) and focuses on the core OIDC client registration only with further enhancements to be added in due course.There are about 3 updates in this PR which impact a large number of files, but only a single one is really about the OIDC client registration. The other two ones just try to make it easier to move ahead with the OIDC client registration work:
quarkus.oidc.runtime.AbstractJsonObject
got moved fromquarkus-oidc
down toquarkus-oidc-common
, to avoid adding the same methods for supporting retrieving JSON for OIDC client registrationClientMetadata
(and longer term, to support OIDC client enhancement request from Stian for OIDC client to support UserInfo, etc) - and this move causes a few import updatesOidcCommonConfig
, which bothquarkus-oidc
OidcTenantConfig
andquarkus-oidc-client
OidcClientConfig
extend, applies to these communications. But a good portion ofOidcCommonConfig
is only relevant to the work ofquarkus-oidc
OidcTenantConfig
andquarkus-oidc-client
OidcClientConfig
. Therefore this PR moves such properties out ofOidcCommonConfig
toOidcClientCommonConfig
leading to the following hierarchies:OidcTenantConfig
->OidcClientCommonConfig
->OidcCommonConfig
,OidcClientConfig
->OidcClientCommonConfig
->OidcCommonConfig
, but onlyOidcClientRegistrationConfig
->OidcCommonConfig
. This leads to a good number of import updates as well. It is not strictly necessary, but then users who create client registrations would see configuration properties not relevant to the client registration process and that would not be great.Finally, we have the actual
quarkus-oidc-client-registration
extension. I've tried to provide a summary of registration patterns it supports in this PR's doc update, please have a look. But here is a brief summary:OidcClientRegistration
represents an OIDC client registration endpoint - it can be created fromOidcClientRegistrationConfig
set either inapplication.properties
or dynamically.OidcClientRegistrationConfig
may specify OIDC address only, but also can have metadata configured for a single client, if it does, thenOidcClientRegistration
will returnRegisteredClient
representing an already registered client at start-upOidcClientRegistration
, in addition to returning client registered at startup, may accept requests to register one or more clients, using Uni and Multi response types respectivelyOidcClientRegistration
can be used without having to usequarkus-oidc
, but only to facilitate the dynamic client registrationTenantConfigResolver
is suited best for using dynamically registered clients and creating OIDC tenant configurationsOidcClientRegistrations
(as opposed toOidcClientRegistration
) provides access to allOidcClientRegistration
s created from configured OIDC client registration configsOidcClientRegistrations
can be used to accept a newOidcClientRegistration
which in turn can be used to register one or more clientsRegisteredClient
represents a registered client and supports interacting with this client-specific registration endpoint to read, update the metadata or delete this clientClientMetadata
is a JSON wrapper which can be used to register new clientsOIDC dynamic client registration is a rather complex area and it is hard to capture all of its subtleties perfectly from the start. Therefore I mark it clearly as an experimental extension, in its metadata and the docs, and I propose to let users stress it after the review dealing with some obvious PR issues. It will become an important feature but it may need a few iterations to settle down.
I'd like to have at least 2 reviews and approvals. Thanks