Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-18129

extraParameters attribute of the @OpenIdAuthenticationMechanismDefinition can't be configured with EL?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 27.0.1.Final
    • Security
    • None
    • ---
    • ---

      I run into a problem using the @OpenIdAuthenticationMechanismDefinition annotation. My initial goal is to write a simple library that exposes all parameters of the OIDC annotation to external config params using Microprofile Config API.

      This would allow me to provide a interoperable Jakarta EE application that can be configured with different OpenID providers like KeyCloak, Auth0, ....

      Also I want to be able to run the app in different runtimes - not only Wildfly (even if this is my preferred platform) . So I can't use the oidc.properties files which seems to be specific to Wildfly only

      So I wrote something like this:

       

      @OpenIdAuthenticationMechanismDefinition(
              clientId = "${configBean.clientId}",
              clientSecret = "${configBean.clientSecret}",
              extraParameters = "${configBean.extraParameters}"
      )
      public class MyBean  {
         ...
      }
      
      @ApplicationScoped
      @Named
      public class ConfigBean implements Serializable {
          ...
          public String getClientId() {
              return clientId;
          }
          public String getClientSecret() {
              return clientSecret;
          }
          public String[] getExtraParameters() {
              return { "audience=abc", "team=def" };
          }
      }
       
      

      All fine so far. But the problem is the `extraParameters`. This param is needed for Auth0 to define the audience API url.  But I did not figured out how to provide this param with Expression Language. This is also a problem which Andrew Hughes explained in this blogpost some time ago: https://auth0.com/blog/jakarta-ee-oidc/

       

      I invested a lot of time and I am still not clear about the root of the problem. The Jakrata EE specification does not provide much information about how to use EL in combination with the @OpenIdAuthenticationMechanismDefinition annotation.

      For String values all works as expected. But not for the complex key/value arrays.

      The Wildfly Server throws the following exception during deployment:

      jakarta.enterprise.inject.spi.DefinitionException: OpenIdAuthenticationMechanismDefinition.extraParameters() value '${configBean.extraParameters}' is not of the format key=value

      Maybe this is not a bug and I am simple useing the parma in the wrong way. In this case can you provide a working code snipped?

       

      I do provide my results also on Github: https://github.com/imixs/imixs-security/tree/main/imixs-oidc

      Thanks for your feedback in advance.

       

              Unassigned Unassigned
              rsoika ralph Soika (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: