-
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
Enhance OidcClientFilter to select named OIDC clients #16397
Comments
/cc @pedroigor |
May be OidcClientFilter configuration can have a |
That said, a custom filter would do quite well too; so |
I think what we can do, is at the point of registering the provider with RestEasy, we can check if the constructor accepting the activating annotation is available, for example, |
I like the idea of introducing a new optional annotation value
But maybe that's a little bit too much on the black bytecode magic side? |
@fwippe yes, I agree :-), I'm hoping the fix will be simpler such that it can also work generically, I'll have a look shortly |
@fwippe While you are looking into the named clients, here is a more concrete proposal:
I believe what should be passed is a holder of (provider Then, in This way we can support a generic feature where the providers can be totally configured via the enabling annotations - and it will work not only for Please investigate |
Sounds like a reasonable approach! But there's a serious drawback: We're no longer talking about CDI beans here, are we? As we're creating the instance ourselves, no injections and scopes will be possible, right? Is that a price you're willing to pay? |
My best guess is |
@fwippe Sure - lets assume the provider has only a default constructor - what I'm curious about, does Resteasy do anything special to ensure the field injection ( |
@sberyozkin The injection mechanism is abstracted in multiple layers. I guess it boils down to using the |
@fwippe the providers registered as classes are submitted directly into MP RestClient's RestClientBuilder. And yet the injection into these providers works. So it may well work with the instances as well. I'll experiment |
Workaround: @Path(BASEPATH)
@RegisterRestClient(configKey = "my-connector")
@OidcClientFilter
public interface KeycloakUserApi [...] solution:
public class ExampleOidcClientRequestFilter extends OidcClientRequestFilter {
@Override
protected Optional<String> clientId() {
return Optional.of("example-client-id"); // has to match configured oidc-client id
}
}
@Path(BASEPATH)
@RegisterRestClient(configKey = "my-connector")
@RegisterProvider(ExampleOidcClientRequestFilter.class)
public interface KeycloakUserApi [...]
quarkus:
oidc-client:
example-client-id:
auth-server-url: [...] |
@fwippe has noticed that
OidcClientFilter
only works with the defaultOidcClient
.It would be useful to have something like this:
If this property is set then the filter implementation would just have to be updated to do
OidcClients.getClient("my-client")
- what is not clear though is howOidcClientFilter
can find out about the client id it needs to use.The text was updated successfully, but these errors were encountered: