To Provide or proctect Web resource , and make force the authentication,whenever unknown user or request comes to this secured web resource, be it
jsp or
servlet,
There are four methods available
1. Basic - JUst popup for user authentication and credentials are sent in base64
2. Client cert - or mutual authentication
3. Form based - To have customized and a cool authentication login page
4. digest - here credentials are digested in md5 or sha specified.
These are ways by which user authentication is forced.
Now How to Validate the credentials with already you hae to know whether the user is the real user with correct credentials
For that we have JAAS
other means are realms. You can authenticate using LDAP, DB [RDBMS Realm]