tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miller, Steve" <sdmil...@dallasnews.com>
Subject JAAS and TOMCAT 5
Date Fri, 13 Feb 2004 20:16:00 GMT
Greetings,

I have finally pulled the last hair out of my head on this one. I'm running
Tomcat 5 on my Windows2000 desktop (for development purposes) and trying to
get JAAS to successfully integrate with it. I have successfully run the
examples from Sun's site for the JAAS tutorial and just trying to get it to
work on Tomcat now. I'm still a bit of a newbie to JAAS, so I'm not sure if
I'm doing something wrong there or just not setting up Tomcat and/or my
windows environment correctly...which I think is the real problem here. I
have exhausted all of my research on the internet and I couldn't find
anything out there regarding JAAS and Tomcat 5..so I thought I'd try here.

Here is the error I am getting from Tomcat:

java.io.IOException: Unable to locate a login configuration
at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:206)
at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:95)

I'm assuming from this message that Tomcat cannot find the JAAS
configuration file. I have it stored as "%CATALINA_HOME%/conf/jaas.conf".
It's code is as follows:
MeritPool {
    JAAS.MyLoginModule required;
};

I have put my compiled classes for my LoginModule, UserPrincipal, and
RolePrincipal under "%CATALINA_HOME%/server/classes/JAAS" as well as
"%CATALINA_HOME%/common/classes/JAAS".

In the java.security file under %JAVA_HOME%/jre/lib/security, I included
"login.config.url.1=file:C:/TOMCAT/conf/jaas.conf".

I have set the JAVA_OPTS environement variable in both my windows
environment, catalina.sh, and catalina.bat files to:
(in catalina.sh)
JAVA_OPTS=-Djava.security.auth.login.config=="$CATALINA_HOME"/conf/jaas.conf

(in catalina.bat) set
JAVA_OPTS="-Djava.security.auth.login.config==%CATALINA_HOME%\conf\jaas.conf
"
(in windows env. variable)
JAVA_OPTS=-Djava.security.auth.login.config==C:/TOMCAT/conf/jaas.conf

In the above lines, I tried it with on "=" as well.

I am using the Tomcat security configuration to "protect" one of my contexts
and to route to a login page. The login page form is submitted to
"j_security_check" with the code as follows:

<form method="GET" action='<%= response.encodeURL("j_security_check") %>' >
  <table border="0" cellspacing="5">
    <tr>
      <th align="right">Username:</th>
      <td align="left"><input type="text" name="j_username"></td>
    </tr>
    <tr>
      <th align="right">Password:</th>
      <td align="left"><input type="password" name="j_password"></td>
    </tr>
    <tr>
      <td align="right"><input type="submit" value="Log In"></td>
      <td align="left"><input type="reset"></td>
    </tr>
  </table>
</form>

This login page works fine using MemoryRealm and authenticates beautifully.
But, when I comment that out in my server.xml file and instead use the
JAASRealm, using the login page doesn't work and Tomcat displays the error
that the login configuration cannot be located. My JAASRealm definition is:

<Realm className="org.apache.catalina.realm.JAASRealm" debug="3"
appName="MeritPool" userClassNames="JAAS.MyPrincipal"
roleClassNames="JAAS.MyRolePrincipal" />

Can somebody here hopefully help me replace some of my lost hair? :-)  I'm
on digest mode, so bear with me if I am delayed in responding.

Thanks in advance!
Steve Miller

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message