• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Error in integrating Simple JAAS with Tomcat 5.0

Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on security module with the following requirement.
1. Authentication should happen once using basic authentication.

2. Any subsequent request should go through the process but should not do the actual authentication rather should check the data from session.

can some provide me sample class and configuration detail to integrate simple LoginModule. At this point I don't have any Autherization requirement, all modules are accessible to all authenticated user. Authentication criteria: user name should same as password.

I have tried it by reading some document. I am able to complete the authentication part I belive but authorization is not working.
Below are the files and steps that I have performed.

web.xml Change
<web-resource-name>Entire Application</web-resource-name>
<!-- Define the Login Configuration for this Application -->
<realm-name>Your Realm</realm-name>

jaas config:
DemoSP {
HttpLoginModule required debug=true;


<Realm className="org.apache.catalina.realm.JAASRealm"

public class HttpLoginModule implements LoginModule {
public boolean login() throws LoginException {
String username = null;
String password = null;
try {
username = ((NameCallback) callbacks[0]).getName();
password = new String(((PasswordCallback) callbacks[1]).getPassword());
} catch (IOException e) {
throw new LoginException(e.toString());
} catch (UnsupportedCallbackException e) {
throw new LoginException(e.toString());
userPrincipal = new SamplePrincipal(username);
return true;
public boolean commit() throws LoginException {
return true;
//default implementation for others

JDK argument :

Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic