Quarkus OIDC Client Grant Configuration

Viewed 172

Following the guide https://quarkus.io/guides/security-openid-connect-client#use-oidcclients and in particular the example

@Path("/clients")
public class OidcClientResource {

    @Inject
    OidcClients clients;

    @GET
    public String getResponse() {
        OidcClientConfig cfg = new OidcClientConfig();
        cfg.setId("myclient");
        cfg.setAuthServerUrl("http://localhost:8081/auth/realms/quarkus/");
        cfg.setClientId("quarkus");
        cfg.getCredentials().setSecret("secret");
        Uni<OidcClient> client = clients.newClient(cfg);
        // use this client to get the token
    }
}

it is not specified how to set the grant_type. Doing a bit of investigation, the class OidcClientConfig has a field grant with no getters/setters and the only way to set the grant was to access it directly and set the Type enum like

cfg.grant.setType(OidcClientConfig.Grant.Type.CODE)

It works, but I wonder if this is just a leftover or if the intended usage is different.

Thank you for the support!

1 Answers
Related