You must validate the users credentials so that the user is authenticated to connect to the messaging engine.
This option is the simplest way of specifying a username and password to authenticate the application connections. You can use the <quickStartSecurity> element to enable a simple (one user) security setup for the Liberty profile. Define the following <quickStartSecurity> element in the server.xml file.
<quickStartSecurity userName="liberty" userPassword="liberty123"/>
<WLP_HOME>\wlp\bin>securityUtility encode "liberty123"
For more information about securing passwords, see Liberty profile: securityUtility command.
<basicRegistry id="basic" realm="customRealm">
<user name="user1" password="user1pwd" />
<user name="user2" password="user2pwd" />
<user name="user3" password="user3pwd" />
<user name="user4" password="user4pwd" />
<user name="user5" password="user5pwd" />
<user name="user6" password="user6pwd" />
<user name="user7" password="user7pwd" />
<user name="user8" password="user8pwd" />
<group name="Developers">
<member name="user2" />
<member name="user4" />
</group>
<group name="Testers">
<member name="user8" />
<member name="user7" />
</group>
</basicRegistry>
<ldapRegistry id="LDAP" realm="SampleLdapIDSRealm" host="ctldap1.austin.ibm.com" port="389"
ignoreCase="true" baseDN="o=ibm,c=us"
ldapType="IBM Tivoli Directory Server"
idsFilters="ibm_dir_server"
searchTimeout="8m">
<failoverServers name="failoverLdapServers">
<server host="ralwang.rtp.raleigh.ibm.com" port="389"/>
</failoverServers>
</ldapRegistry>
<jmsQueueConnectionFactory jndiName="myQCF" connectionManagerRef="ConMgr4">
<properties.wasJms userName="liberty" password="liberty123"
remoteServerAddress="localhost:7276:BootstrapBasicMessaging">
</properties>
</jmsQueueConnectionFactory>
<connectionManager id="ConMgr4" maxPoolSize="2"/>
In the previous example, the application that looks for the myQCF queue connection factory is automatically authenticated against the user name liberty and password liberty123 that is defined for the configured registry.
server.xml
--------------------
<jmsQueueConnectionFactory jndiName="myQCF" connectionManagerRef="ConMgr4">
<properties.wasJms
remoteServerAddress="localhost:7276:BootstrapBasicMessaging">
</properties>
</jmsQueueConnectionFactory>
<connectionManager id="ConMgr4" maxPoolSize="2"/>
Application snippets
------------------
QueueConnectionFactory qcf = (QueueConnectionFactory) new InitialContext().lookup("myQCF");
QueueConnection qCon = qcf.createQueueConnection(“liberty”, “liberty123”);
<authData id="auth1" user="liberty" password="liberty123"/>
<jmsQueueConnectionFactory jndiName="myQCF"
containerAuthDataRef=”auth1” connectionManagerRef="ConMgr4">
<properties.wasJms/>
</ jmsQueueConnectionFactory >
<connectionManager id="ConMgr4" maxPoolSize="2"/>
server.xml
-------------
<authData id="auth1" user="dbuser1" password="{xor}Oz0vKDtu"/>
<jmsQueueConnectionFactory id="jndi/myQCF" jndiName="jndi/myQCF" connectionManagerRef="ConMgr4">
<properties.wasJms/>
</jmsQueueConnectionFactory>
<connectionManager id="ConMgr4" maxPoolSize="2"/>
web.xml
----------
<resource-ref>
<res-ref-name>jndi/myQCF</res-ref-name>
<res-auth>Container</res-auth>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<lookup-name>jndi/myQCF</lookup-name>
</resource-ref>
ibm-web-bnd.xml(web binding file)
----------------
<resource-ref name="jndi/myQCF" binding-name="jndi/myQCF">
<authentication-alias name="auth1"/>
</resource-ref>