To encrypt the password for data source on JBoss Application Server 7 version, update the standalone.xml file.
Procedure
Add SecureIdentityLoginModule and Security Domain
Go to $JBOSS_HOME/standalone/configuration directory and open the standalone.xml file.
Under <security-domains> element, add the EncryptedPassword security-domain and SecureIdentityLoginModule along with username and password module options. For example,
Under the <datasources> element, remove the following existing <user-name> and <password> from the <security> element because you have already added <user-name> and <password> as module options in the previous step:
<datasources>
<datasource ... >
.....
<security>
<user-name>mdmuser</user-name>
<password>mdmpassword</password>
</security>
</datasource>
</datasources>
Under the <datasources> element, add the EncryptedPassword security-domain, such as: