git-yogi opened a new issue, #2194:
URL: https://github.com/apache/activemq/issues/2194

   ## Summary
   `activemq-ra` advertises `BasicPassword` authentication with 
`jakarta.resource.spi.security.PasswordCredential`, but 
`ActiveMQManagedConnectionFactory` does not extract credentials from the 
`Subject` provided by the application server.
   
   Because of that, when a JCA container such as JBoss / WildFly passes 
username and password via `Subject` instead of `ActiveMQConnectionRequestInfo`, 
the adapter ignores them and falls back to CRI or factory defaults.
   
   ## Relevant code
   
`activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnectionFactory.java`
   
   ```java
   @Override
   public ManagedConnection createManagedConnection(Subject subject, 
ConnectionRequestInfo connectionRequestInfo) throws ResourceException {
       ActiveMQConnectionRequestInfo amqInfo = getInfo();
       if (connectionRequestInfo instanceof ActiveMQConnectionRequestInfo) {
           amqInfo = (ActiveMQConnectionRequestInfo) connectionRequestInfo;
       }
       try {
           return new ActiveMQManagedConnection(subject, 
makeConnection(amqInfo), amqInfo);
       } catch (JMSException e) {
           throw new ResourceException("Could not create connection.", e);
       }
   }
   ```
   
   `makeConnection(...)` uses only 
`ActiveMQConnectionRequestInfo.getUserName()` / `getPassword()`, and there 
appears to be no `PasswordCredential` handling anywhere in `activemq-ra`.
   
   ## Spec reference
   Jakarta Connectors 2.1, “Contract for the Application Server”:
   
https://jakarta.ee/specifications/connectors/2.1/jakarta-connectors-spec-2.1#contract-for-the-application-server
   
   Given the declared authentication mechanism, the adapter should honor 
credentials supplied by the application server through `Subject` / 
`PasswordCredential`.
   
   ## Expected behavior
   When `Subject` contains a matching `PasswordCredential`, the adapter should 
use it when creating and matching managed connections.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to