Skip to content

activemq-ra ignores Subject PasswordCredential in ManagedConnectionFactory authentication flow #2194

Description

@git-yogi

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

@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions