Skip to content
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

Cannot figure out how to create an instance of JsonWebKeyList when creating an OpenIDConnectApplication using private_key_jwt. #566

Closed
youngm opened this issue Mar 25, 2021 · 2 comments

Comments

@youngm
Copy link

youngm commented Mar 25, 2021

I'm submitting a

  • [?] bug report
  • [?] feature request

Background info

I'm attempting to create a OpenIDConnectApplication using private_key_jwt. I cannot figure out how to supply an initial JsonWebKeyList to the OpenIdConnectApplicationSettingsClientKeys. I'm not referring to creating the keys, Just how to put the keys into a JsonWebKeyList for the Settings object to consume.

Expected behavior

I should be able to create a JSonWebKeyList and put it in a OpenIdConnectApplicationSettingsClientKeys instance.

What went wrong?

I cannot figure out how to create a JsonWebKeyList. It is either not possible or not very obvious today that is why I'm creating this ticket.

Steps to reproduce

This is how far I've gotten creating my OpenIDConnectApplication.

client
    .instantiate(OpenIdConnectApplication.class)
    .setCredentials(
        client
            .instantiate(OAuthApplicationCredentials.class)
            .setOAuthClient(
                client
                    .instantiate(ApplicationCredentialsOAuthClient.class)
                    .setTokenEndpointAuthMethod(
                        OAuthEndpointAuthenticationMethod.PRIVATE_KEY_JWT)))
    .setSettings(
        client
            .instantiate(OpenIdConnectApplicationSettings.class)
            .setOAuthClient(
                client
                    .instantiate(OpenIdConnectApplicationSettingsClient.class)
                    .setResponseTypes(List.of(OAuthResponseType.TOKEN))
                    .setGrantTypes(List.of(OAuthGrantType.CLIENT_CREDENTIALS))
                    .setApplicationType(OpenIdConnectApplicationType.SERVICE)
                    .setJwks(
                        client.instantiate(
                            OpenIdConnectApplicationSettingsClientKeys.class).setKeys(?????))));

SDK Version

3.1.0

@bdemers
Copy link
Contributor

bdemers commented Mar 25, 2021

Hi @youngm!

Thanks for reaching out! I took a quick look, and it looks like that's an issue with our SDK.

You can work around the issue in the short term by calling the put method on the OpenIdConnectApplicationSettingsClient that you created, so something like this:

OpenIdConnectApplicationSettingsClient settings = client.instantiate(OpenIdConnectApplicationSettingsClient.class)
      .setResponseTypes(List.of(OAuthResponseType.TOKEN))
      .setGrantTypes(List.of(OAuthGrantType.CLIENT_CREDENTIALS))
      .setApplicationType(OpenIdConnectApplicationType.SERVICE);

settings.put("jwks", List.of(...))

Where each item in the list could be a map, containing your JWK properties, i.e.:

{
  "kty" : "...",
  "alg" : "...",
  "use" : "sig",
  "n" : "...",
  "e" : "...",
  "d" : "...",
  "p" : "...",
  "q" : "...",
  "dp" : "...",
  "dq" : "...",
  "qi" : "..."
}

We will streamline this in the future and it to an ApplicationBuilder.

@arvindkrishnakumar-okta
Copy link
Contributor

Fixed in v4.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants