I’m building a new Java web application for my employer. First thing it needs are all the basic features like an ‘i want to create an account’ page, a ‘login’ form, a ‘i forgot my password’ feature, and so on.
I can build all this from scratch, but is there an already existing Java tool, or open source project, or Java library (free or not) out there that gives me all of this stuff right form the start?
I would use a Maven Archetype such as the ones listed on https://maven.apache.org/archetypes/
It creates the whole application structure, with all directories and minimum configuration files required and ready for use.
Of course, you would have to use Maven then, but I would also recommend that!
I found this quick tutorial that might be of help: http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/
If you choose to use Spring (and there are several Maven archetype that will set up a web app with Spring for you), then you will have Spring security which enables security management out-of-the-box with minimum configuration. This guide (https://spring.io/guides/gs/securing-web/) seems to be quite easy to follow.
You may also consider to let authentication taken care by the Web server, rather than the web app itself. For example, if you use Tomcat, you can require users to be in tomcat-users. When you try to access the web application deployed under Tomcat, Tomcat will ask for the user’s credentials automatically with a pop-up window. If you download Tomcat, it will come with the Tomcat Manager app, which uses this “Basic Authentication” method…. really useful if you’re not writing web applications for the general public, just internally.
This link (https://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html) shows how to use Tomcat’s authentication.
I hope to have answered your question… good luck.
2017 update
Spring Boot has a good guide to quickly create a secure a web application:
https://docs.spring.io/spring-security/site/docs/current/guides/html5/helloworld-boot.html