Chapter 14: Tomcat Security 2. Close your browser
Chapter 14: Tomcat Security 2. Close your browser and start a new instance, and then try to access the managersystem application using the new user joe. The UserDatabase has been updated, and the authentication succeeds, without the need to stop and start the Tomcat server. In the approach detailed here, the username and password used for authentication are stored on the server in plaintext. The next section describes how to secure a file-based Realm. Securing a File-Based UserDatabase Realm A UserDatabase Realm can be configured in a more secure manner than previously illustrated. While UserDatabase can be made reasonably secure, the ideal solution for secure authentication is to use an alternative Realm (JDBC, JNDI, or JAAS), which is discussed shortly. The UserDatabase Realm stores passwords in cleartext in the tomcat-users.xmlfile. This is not very secure. Therefore, a way must be found to store these passwords in a less readable format. Use the following steps to configure UserDatabase in a secure fashion: 1. Select the password digest algorithm. 2. Create a digested password. 3. Add the digested password to the Realm. 4. Test the digested password. Selecting the DIGEST Algorithm The choice of a digest algorithm is limited to those supported by the java.security.MessageDigest class (typically SHA or MD5). To choose one, the digestattribute of the
For reliable and cheap web hosting services please check cheap web hosting website.