Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-9662

Invocations on UserTransaction obtained from InitialContext don't take user credentials into account

    XMLWordPrintable

Details

    • Workaround Exists
    • Hide

      Configure a org.wildfly.security.auth.client.AuthenticationContext separately from the InitialContext and invoke transaction operations with it.

      Show
      Configure a org.wildfly.security.auth.client.AuthenticationContext separately from the InitialContext and invoke transaction operations with it.

    Description

      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY, WildFlyInitialContextFactory.class.getName());
      props.put(Context.PROVIDER_URL, "remote+http://127.0.0.1:8080");
      props.put(Context.SECURITY_PRINCIPAL, "joe");
      props.put(Context.SECURITY_CREDENTIALS, "joeIsAwesome2013!");
      InitialContext ctx = new InitialContext(props);
      UserTransaction tx = (UserTransaction)ctx.lookup("txn:UserTransaction");
      tx.begin();
      

      The begin() call from this snippet will fail with:

      Exception in thread "main" javax.transaction.SystemException: WFTXN0021: Failed to acquire a connection for this operation
      	at org.wildfly.transaction.client.provider.remoting.RemotingRemoteTransactionPeer.begin(RemotingRemoteTransactionPeer.java:168)
      	at org.wildfly.transaction.client.RemoteUserTransaction.begin(RemoteUserTransaction.java:62)
      	at client.Client.main(Client.java:26)
      Caused by: javax.security.sasl.SaslException: Authentication failed: none of the mechanisms presented by the server (JBOSS-LOCAL-USER, DIGEST-MD5) are supported
      	at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:426)
      	at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:241)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
      	at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
      	at org.xnio.nio.WorkerThread.run(WorkerThread.java:567)
      	at ...asynchronous invocation...(Unknown Source)
      	at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:465)
      	at org.jboss.remoting3.FutureConnection.getConnection(FutureConnection.java:117)
      	at org.jboss.remoting3.FutureConnection.init(FutureConnection.java:77)
      	at org.jboss.remoting3.FutureConnection.get(FutureConnection.java:152)
      	at org.jboss.remoting3.EndpointImpl.doGetConnection(EndpointImpl.java:407)
      	at org.jboss.remoting3.EndpointImpl.getConnection(EndpointImpl.java:341)
      	at org.jboss.remoting3.UncloseableEndpoint.getConnection(UncloseableEndpoint.java:55)
      	at org.jboss.remoting3.Endpoint.getConnection(Endpoint.java:135)
      	at org.wildfly.transaction.client.provider.remoting.RemotingRemoteTransactionPeer.lambda$getOperations$0(RemotingRemoteTransactionPeer.java:63)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at org.wildfly.transaction.client.provider.remoting.RemotingRemoteTransactionPeer.getOperations(RemotingRemoteTransactionPeer.java:63)
      	at org.wildfly.transaction.client.provider.remoting.RemotingRemoteTransactionPeer.begin(RemotingRemoteTransactionPeer.java:166)
      	... 2 more
      

      The InitialContext can successfully be used to invoke EJBs, but operations on transactions fail with an authentication failure.

      Attachments

        Issue Links

          Activity

            People

              dlloyd@redhat.com David Lloyd
              jmartisk@redhat.com Jan Martiska
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: