Spring authentication with Wicket authorization
So far we have seen various options to use Spring Security outside the Wicket application. We shall now see how we can create a security form in the wicket framework and use it with the Spring framework with two different roles. The recipe also demonstrates how we can use Spring beans in the Wicket application.
Getting ready
Create a Maven Wicket project:
spring-security-wicket
.Update the
pom.xml
file with Spring dependency.Create an
applicationContext.xml
file. It's mandatory to name it asapplicationContext
or else we will get error messages in the console.Add a
spring-wicket-security
dependency.Edit the
web.xml
with Spring listeners.Create
EditorPage.html
andAuthorPage.html
and correspondingEditorPage.java
andAuthorPage.java
respectively. The author page and the editor page are similar pages but invoked based on roles.Create a
HomePage.java
andHomePage.html
.Create
SignInPage.html
andSignInPage.java
.Subclass the
AuthenticatedWebSession...