• Post Reply Bookmark Topic Watch Topic
  • New Topic

Steps to implement user authentication  RSS feed

 
Vasilis Souvatzis
Ranch Hand
Posts: 81
1
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good evening everyone. I hope I'm posting in the right place, I've been trying all day to make this work and I'm completely overwhelmed right now...

For my uni thesis I'm building a JavaEE 7 web app and I want to add user authentication. Although I haven't found a complete guide, via the resources I've gathered I think I'm quite close. I can't make it work though. In all honesty I don't understand ALL of the code yet, I'm using it though because it's supposed to work, it's from JavaEE 7 Recipes book.

I've created my database, set up the JDBC realm in GlassFish, added the persistence unit, created the entity classes, the backing bean, the ejb, called the EL expressions...

When I'm supposed to login it throws a "loginBean.username is unreachable" or something. I don't understand why, the inputText's value is supposed to go straight to the backing bean right?

I know this is a very vague description but I can provide you with all the code you may want, it's simply I cannot think of anything to do right now since I'm not familiar with the methodology yet...

Any thoughts?
 
Vasilis Souvatzis
Ranch Hand
Posts: 81
1
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well no wonder I couldn't make it work, my settings files were probably messed up from all the editing and I didn't follow the correct instructions.

Luckily I found this magnificent tutorial and I finally have all the settings correct. Later I will change it to use Managed Beans for user auth but for now this is perfect.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
User-written login code is notoriously insecure. Unless you strictly want it as an academic example, I urge you to avoid it.

J2EE defines and documents a standard security system that manages both authentication (login) and coarse-grained authorization (Role-Based Access Control). It is configured into the webapp deployment and is managed by the server itself. No user-written code is required.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!