From the course: Java EE 8: JavaServer Faces JSF 2.3

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Authentication in the managed bean

Authentication in the managed bean

From the course: Java EE 8: JavaServer Faces JSF 2.3

Start my 1-month free trial

Authentication in the managed bean

- [Instructor] Having configured our Credentials data source and authentication mechanism both using annotations, we now need to authenticate unauthorized users against the Credentials data source. I've configured the web.xml to restrict access to the socket-sender.xhtml page on line 33, using the good old security constraint mechanism that we all know and love as part of the servlet spec. So here between lines 27 and line 41, I've defined that socket-sender.xhtml should be restricted only to users with the SAMPLE_ROLE access. Let's start from this RequestScoped bean that I've pre-created. I'll use this bean to collect the username and password sent from the login page. So as you can see here I have defined a field named username on line 13, a field named password on line 16 and I'm using the @NotNull annotation from the Bean Validation package, to ensure that neither the username nor password are not when submitted…

Contents