tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter B. West" <pbw...@powerup.com.au>
Subject Re: JDBCRealm
Date Tue, 08 May 2001 14:09:27 GMT
Have you tried
<RequestInterceptor className="org.apache.tomcat.request.JDBCRealm"
  debug="99"
  driverName="org.gjt.mm.mysql.Driver
  connectionURL="jdbc:mysql://localhost/authority"
  connectionName="authcheck"
  connectionPassword="passcheck"
  userTable="Users" userNameCol="UserName" userCredCol="PassWord"
  userRoleTable="UserRoles" roleNameCol="RoleName"
 />

When you are playing with the admin user and admin context in the
distribution, the context has to be set to trusted.  In 3.3M2, the
context for the admin webapp is set in $TOMCAT_HOME/conf/apps-admin.xml,
which includes the following:
    <!-- Special rules for the admin webapplication -->

    <!-- Change "trusted" to true in order to run the admin -->
    <!-- Removed SimpleRealm for testing with JBDCRealm
            <SimpleRealm filename="conf/users/admin-users.xml" />
  -->
    <Context path="/admin" 
             docBase="webapps/admin" 
             reloadable="true" 
             trusted="true" > 
    </Context>

Note the `trusted="true"' in the Context element.  For earlier versions,
this is generally found in the mod_jk.conf file in /var/tomcat/conf (I
think). 

Peter

> Kevin Fonner wrote:
> 
> Of so I have been experimenting with this JDBCRealm stuff and can't
> seem to make it ask me for a user name and password.
> 
> in the server.xml is..
> <RequestInterceptor className="org.apache.tomcat.request.JDBCRealm"
> debug="99"
> driverName="org.gjt.mm.mysql.Driver"
> connectionURL="jdbc:mysql://localhost/authority?user=authcheck;password=passcheck"
> userTable="Users" userNameCol="UserName" userCredCol="PassWord"
> userRoleTable="UserRoles" roleNameCol="RoleName" />
> 
> in the examples web.xml is...
> <security-constraint>
>       <web-resource-collection>
>          <web-resource-name>Protected Area</web-resource-name>
>   <!-- Define the context-relative URL(s) to be protected -->
>          <url-pattern>/examples/servlets/*</url-pattern>
>   <!-- If you list http methods, only those methods are protected -->
>   <http-method>DELETE</http-method>
>          <http-method>GET</http-method>
>          <http-method>POST</http-method>
>   <http-method>PUT</http-method>
>       </web-resource-collection>
>       <auth-constraint>
>          <!-- Anyone with one of the listed roles may access this area
> -->
>          <role-name>tomcat</role-name>
>   <role-name>role1</role-name>
>       </auth-constraint>
>     </security-constraint>
> 
>     <!-- Default login configuration uses BASIC authentication -->
>     <login-config>
>       <auth-method>BASIC</auth-method>
>       <realm-name>Example Basic Authentication Area</realm-name>
>     </login-config>
> 
> Shouldn't all this require the server to ask me for a password before
> I can use any of my servlets or am I missing something here?
> 

-- 
Peter B. West  pbwest@powerup.com.au  http://powerup.com.au/~pbwest
"Lord, to whom shall we go?"

Mime
View raw message