Uploaded image for project: 'WildFly Elytron'
  1. WildFly Elytron
  2. ELY-2206

Unable to Use OAUTHBEARER with JMS ConnectionFactory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.16.1.Final
    • None
      1. Install Keycloak
      2. Create a SASL authentication factory with an OAUTHBEARER mechanism
      3. Using the domain, set the <elytron-provider> in the ActiveMQ section
      4. Apply the client code as described above

      I'm running WildFly 24 and trying to lookup a JMS ConnectionFactory authenticating against an OAUTHBEARER domain.  I'm getting the following error

      WFNAM00032: Peer authentication failed [Root exception is org.wildfly.security.auth.AuthenticationException:

      I'm creating a context like this (which works for remote EJBs).

      AuthenticationConfiguration authConfig =
      {{ AuthenticationConfiguration}}
      {{   .empty()}}
      {{   .setSaslMechanismSelector(SaslMechanismSelector.NONE.addMechanism("OAUTHBEARER"))}}
      {{   .useBearerTokenCredential(}}
      {{     new BearerTokenCredential(token)}}
      {{   );}}

      AuthenticationContext authContext = AuthenticationContext

      .empty().with(MatchRule.ALL, authConfig);authContext.runCallable( () ->{{

      {   final Hashtable<String, String> jndiProperties = new Hashtable<>();   jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");    jndiProperties.put(Context.PROVIDER_URL, providerURL);    final Context context = new InitialContext(jndiProperties);   ConnectionFactory jms = (ConnectionFactory)     context.lookup("jms/RemoteConnectionFactory"); // error here }

      }});

            Unassigned Unassigned
            walkerca Carl Walker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: