Been looking into security in regards to webapps; which until now I have just used handwritten classes for simple
username/password lookups.
I have had a play around with j_security_check/Realms with
Tomcat and this all seems pretty straight forward (but nbot sure what it gives you, that doing this yourself doesn't).
But recently started looking into
J2EE JAAS and got to thinking... WHat is actually that good about JAAS?
Looking at a simple example I see that it (for this example) reads in your username/password
Passes them into a LoginContext (what?) which uses a hand written CallbackHandler class which in turn calls a
LoginModule (a lot of classes going on here)
The CallbackHandler then just seems to take the username/password and set something called NameCallback & PasswordCallback
which then get passed into the LoginModule.login method which (again) sets a NameCallback & PasswordCallback
but ultimately all it then does is a simplest of simple 'isEquals' checks:
So what has JAAS actually done that a simple handwritten class which passes in a username/password encrypts the password to something like SHA-512 and then does a simple lookup of the username, gets the User object, gets the salt (however you fancy doing that) for that User and encrypts the passed in password and compares to the password related to the found username, doesn't?
Whenever I try to find an answer into why
you should use JAAS, I usually just find some copy-n-pasted reference that's clearly come from the
Java offical description of what JAAS is, but not actual hand-on experience of it benefits.
What makes JAAS more secure, easier, benefitial in the real World, is it more secure than a DIY authentication, or is it just a way of saying "Our website used J2EE JAAS security".