So Java EE 6 is out, and you’ve decided to give it a go. You’re trying to port an existing application over to the new stack (or are trying to create a new one for the first time,) but exceptions are bursting through the seams and you just can’t seem to get things to work. If you’re familiar with Spring and Hibernate (with all the joy that is OpenSessionInView or
OpenSessionInConversation,) more than likely the problems you’re having are related to the Java Persistence API (
JPA), combined with Enterprise Java Beans (
EJB). Contexts and Dependency Injection (
CDI) should be a familiar face if coming from Spring, but things are subtly different in the world of Java EE.
So you’ve got Spring Security up and running. Great! Now you’ve got a login page, and you just added a form on the global page menu to allow users to Login from any public page. There’s just one problem. When they log-in from a public page, they’re redirected to the default-login-url! Your users will have to re-navigate to the page they were already viewing when they logged in, or maybe they’ll just use the much dreaded “Back” button. That’s not a good interaction, but we have a solution.
A correction has been made to the post: http://ocpsoft.com/java/acegi-spring-security-jsf-login-page/
, fixing an issue where FacesMessages were not being displayed on failed authentications.
We’ve gotten a good number of comments from Lincoln’s
latest post on Spring Security and JSF
. A few comments have asked for further code samples on how to get this example working.
We created a runnable project for this example, and it can be downloaded here