My ActiveMQ uses an authentication plugin as shown below:
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="${activemq.username}" password="${activemq.password}"
groups="admins,publishers,consumers"/>
<authenticationUser username="${admin.username}" password="${admin.password}"
groups="admins,publishers,consumers"/>
</users>
</simpleAuthenticationPlugin>
</plugins>
Could you say how ActiveMQ Artemis should handle this?
CodePudding user response:
There are lots of ways to configure user credentials in ActiveMQ Artemis as discussed in the documentation. However, the default, and probably simplest, way is via the artemis-users.properties
and artemis-roles.properties
files in the broker instance's etc
directory. Given your example, you would configure them as follows...
Each line in artemis-users.properties
follows the pattern of <user> = <password>
:
myUser = myPassword
myAdminUser = myAdminPassword
The passwords can be hashed if you like so they aren't in plain-text. Simply use the command: artemis mask --hash <password>
. You can take the output of that command and encapsulate it in ENC()
, e.g.:
myUser = ENC(1024:D39BB78A7F474C285FA0F2B7AC1D8C4ABB4FAC3C6E49232CED3BDB489660E3CE:C9952A7B86EF49D38EF14F5FEDDC2BECC035E3C96F612302623AE2FDAF8D1DEEB298FEC4A07D6381557407C141D5756FF68C33AE88AE9934BAD01A82DC913E31)
More details can be found in the documentation.
Each line in artemis-roles.properties
follows the pattern of <role> = <users>
:
admins = myUser, myAdminUser
publishers = myUser, myAdminUser
consumers = myUser, myAdminUser
Once the broker is running these files can be modified directly or via the management API (e.g. via the web console or Jolokia). Management is also exposed via the artemis user
command available from the command line. Modifications made during runtime are reflected in the broker by default.