Class JaasDualAuthenticationBroker

  • All Implemented Interfaces:
    Broker, Region, AuthenticationBroker, Service

    public class JaasDualAuthenticationBroker
    extends BrokerFilter
    implements AuthenticationBroker
    A JAAS Authentication Broker that uses different JAAS domain configurations depending if the connection is over an SSL enabled Connector or not. This allows you to, for instance, do DN based authentication for SSL connections and use a mixture of username/passwords and simple guest authentication for non-SSL connections.

    An example login.config to do do this is:

     activemq-domain {
       org.apache.activemq.jaas.PropertiesLoginModule sufficient
       org.apache.activemq.jaas.GuestLoginModule sufficient
     activemq-ssl-domain {
       org.apache.activemq.jaas.TextFileCertificateLoginModule required
    • Constructor Detail

      • JaasDualAuthenticationBroker

        public JaasDualAuthenticationBroker​(Broker next,
                                            String jaasConfiguration,
                                            String jaasSslConfiguration)
        Simple constructor. Leaves everything to superclass.
        next - The Broker that does the actual work for this Filter.
        jaasConfiguration - The JAAS domain configuration name for non-SSL connections (refer to JAAS documentation).
        jaasSslConfiguration - The JAAS domain configuration name for SSL connections (refer to JAAS documentation).
    • Method Detail

      • addConnection

        public void addConnection​(ConnectionContext context,
                                  ConnectionInfo info)
                           throws Exception
        Overridden to allow for authentication using different Jaas configurations depending on if the connection is SSL or not.
        Specified by:
        addConnection in interface Broker
        addConnection in class BrokerFilter
        context - The context for the incoming Connection.
        info - The ConnectionInfo Command representing the incoming connection.
        Exception - TODO
      • removeDestination

        public void removeDestination​(ConnectionContext context,
                                      ActiveMQDestination destination,
                                      long timeout)
                               throws Exception
        Description copied from interface: Region
        Used to destroy a destination. This should try to quiesce use of the destination up to the timeout allotted time before removing the destination. This will remove all persistent messages associated with the destination.
        Specified by:
        removeDestination in interface Region
        removeDestination in class BrokerFilter
        context - the environment the operation is being executed under.
        destination - what is being removed from the broker.
        timeout - the max amount of time to wait for the destination to quiesce
        Exception - TODO
      • authenticate

        public SecurityContext authenticate​(String username,
                                            String password,
                                            X509Certificate[] peerCertificates)
                                     throws SecurityException
        Description copied from interface: AuthenticationBroker
        Authenticate the given user using the mechanism provided by this service.
        Specified by:
        authenticate in interface AuthenticationBroker
        username - the given user name to authenticate, null indicates an anonymous user.
        password - the given password for the user to authenticate.
        peerCertificates - for an SSL channel the certificates from remote peer.
        a new SecurityContext for the authenticated user.
        SecurityException - if the user cannot be authenticated.