We will create a login functionality in
this recipe. The user will be able to log in as admin or client. We will not use a database in this recipe. We will use a dummy service where we just hardcode two users. The first user will be "admin" and the second user will be "client". There will be also two authorities (or roles), ADMIN
and CLIENT
.
We will use Java annotation-driven Spring configuration.
Create a new Maven project from the Vaadin archetype.
mvn archetype:generate \ -DarchetypeGroupId=com.vaadin \ -DarchetypeArtifactId=vaadin-archetype-application \ -DarchetypeVersion=LATEST \ -Dpackaging=war \ -DgroupId=com.app \ -DartifactId=vaadin-spring-login \ -Dversion=1.0
Maven archetype generates the basic structure of the project. We will add the packages and classes, so the project will have the following directory and file structure: