You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Edward Quick <ed...@hotmail.com> on 2008/03/12 11:36:56 UTC

memoryrealm

Hi,

I would like to specify my own tomcat-users.xml for my webapp to use (not the server's main one in  conf/tomcat-user.xml).

I tried the following configuration in my webapp's context.xml file but unfortunately when I went to the URL, I wasn't even prompted for a logon:

<Context path="/sample" debug="0" privileged="true">
        <Realm className="org.apache.catalina.realm.MemoryRealm" path="/tmp/tomcatusers.xml" />
</Context>

Could someone tell me if this is possible, and if so what I need to do to set up the login prompt please?

Thanks,

Ed.



_________________________________________________________________
Telly addicts unite!
http://www.searchgamesbox.com/tvtown.shtml

RE: memoryrealm

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Edward Quick [mailto:edwardquick@hotmail.com] 
> Subject: RE: memoryrealm
> 
> I'm not sure about that because I copied the format that's 
> used in the tomcat manager webapp 's web.xml in 
> tomcat-5.5.16/server/webapps/manager/WEB-INF/web.xml

O.k., I could be mistaken.  However, both 5.5's admin app and
LambdaProbe use the same authentication, and there's no <resource-ref>
or <resource-env-ref> in their web.xml files.

You might want to try a current version of Tomcat, just to be on the
safe side.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: memoryrealm

Posted by Edward Quick <ed...@hotmail.com>.
Thanks Chuck,

I'm not sure about that because I copied the format that's used in the tomcat manager webapp 's web.xml in tomcat-5.5.16/server/webapps/manager/WEB-INF/web.xml

which has in it:

  <!-- Define reference to the user database for looking up roles -->
  <resource-env-ref>
    <description>
      Link to the UserDatabase instance from which we request lists of
      defined role names.  Typically, this will be connected to the global
      user database with a ResourceLink element in server.xml or the context
      configuration file for the Manager web application.
    </description>
    <resource-env-ref-name>users</resource-env-ref-name>
    <resource-env-ref-type>
      org.apache.catalina.UserDatabase
    </resource-env-ref-type>
  </resource-env-ref>


> 
> > I also updated the webapps web.xml file so that it refers 
> > to SampleUserDatabase instead of Tomcat's UserDatabase.
> 
> You shouldn't do that; the webapp isn't using the Resource, only the
> Realm is.  That might be causing the problem.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Telly addicts unite!
http://www.searchgamesbox.com/tvtown.shtml

RE: memoryrealm

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Edward Quick [mailto:edwardquick@hotmail.com] 
> Subject: RE: memoryrealm

> I also updated the webapps web.xml file so that it refers 
> to SampleUserDatabase instead of Tomcat's UserDatabase.

You shouldn't do that; the webapp isn't using the Resource, only the
Realm is.  That might be causing the problem.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: memoryrealm

Posted by Edward Quick <ed...@hotmail.com>.
Thanks Chuck.

Here is my context.xml now:

<Context debug="9" privileged="true">
  <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="SampleUserDatabase" />
  <Resource name="SampleUserDatabase" auth="Container" type="org.apache.catalina.UserDatabase"
        description="User database that can be updated and saved"
        factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
        pathname="/tmp/tomcatusers.xml" />
</Context>

And this is in the webapp's META-INF. I also updated the webapps web.xml file so that it refers to SampleUserDatabase instead of Tomcat's UserDatabase.

  <resource-env-ref>
    <resource-env-ref-name>SampleUserDatabase</resource-env-ref-name>
    <resource-env-ref-type>
      org.apache.catalina.UserDatabase
    </resource-env-ref-type>
  </resource-env-ref>

Unfortunately I still get the same error when the webapp gets deployed:

2008-03-12 16:45:58,917 ERROR org.apache.catalina.core.ContainerBase.[Catalina].[161.2.225.250].[/sample] - Exception looking up UserDatabase under key SampleUserDatabase
javax.naming.NameNotFoundException: Name SampleUserDatabase is not bound in this Context
  at org.apache.naming.NamingContext.lookup(NamingContext.java:769)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
  at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:253)
  at org.apache.catalina.core.StandardContext.start(StandardContext.java:4096)



> > 
> > <Context path="/sample" debug="9" privileged="true">
> 
> Unless your <Context> element is in server.xml (it shouldn't be), the
> path attribute is not allowed; remove it.  If you did put your <Context>
> element in server.xml, move it to the proper location (the webapp's
> META-INF/context.xml file).
> 
> >         <ResourceLink name="SampleDatabase" 
> > global="SampleDatabase" type="org.apache.catalina.UserDatabase"
> >         <Resource name="SampleDatabase" auth="Container" 
> > type="org.apache.catalina.UserDatabase"
> > description="User database that can be updated and saved"             
> > factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
> >                 pathname="/tmp/tomcatusers.xml" />
> 
> You can't have both a <Resource> and a <ResourceLink> for the same item.
> <ResourceLink> should only be used when you've defined a global
> resource, which you're not doing here; remove it.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Get Hotmail on your mobile, text MSN to 63463!
http://mobile.uk.msn.com/pc/mail.aspx

RE: memoryrealm

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Edward Quick [mailto:edwardquick@hotmail.com] 
> Subject: RE: memoryrealm
> 
> <Context path="/sample" debug="9" privileged="true">

Unless your <Context> element is in server.xml (it shouldn't be), the
path attribute is not allowed; remove it.  If you did put your <Context>
element in server.xml, move it to the proper location (the webapp's
META-INF/context.xml file).

>         <ResourceLink name="SampleDatabase" 
> global="SampleDatabase" type="org.apache.catalina.UserDatabase"
>         <Resource name="SampleDatabase" auth="Container" 
> type="org.apache.catalina.UserDatabase"
> description="User database that can be updated and saved"             
> factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>                 pathname="/tmp/tomcatusers.xml" />

You can't have both a <Resource> and a <ResourceLink> for the same item.
<ResourceLink> should only be used when you've defined a global
resource, which you're not doing here; remove it.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: memoryrealm

Posted by Edward Quick <ed...@hotmail.com>.
I realise now what I'm actually trying to do is something like the following where I give my webapp its own UserDatabase instead of using Tomcat's one which is based on conf/tomcat-users.xml:

<Context path="/sample" debug="9" privileged="true">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="SampleDatabase" />
        <ResourceLink name="SampleDatabase" global="SampleDatabase" type="org.apache.catalina.UserDatabase"
        <Resource name="SampleDatabase" auth="Container" type="org.apache.catalina.UserDatabase"
                description="User database that can be updated and saved"
                factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                pathname="/tmp/tomcatusers.xml" />
</Context>

The above gives me the following error on deployment though:

2008-03-12 15:33:11,095 ERROR org.apache.catalina.core.ContainerBase.[Catalina].[161.2.225.250].[/sample] - Exception looking up UserDatabase under key SampleDatabase
javax.naming.NameNotFoundException: Name SampleDatabase is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:769)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:253)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4096)



> From: edwardquick@hotmail.com
> To: users@tomcat.apache.org
> Subject: RE: memoryrealm
> Date: Wed, 12 Mar 2008 12:51:20 +0000
> 
> 
> I don't know if this helps, but here's an extract from the log below. This gets created at deployment, but when I visit the URL, I don't get any output.
> 
> Also I've determined now that the sample app is using conf/tomcat-users.xml and not my own /tmp/tomcatusers.xml file as I get a 403 returned when I put in the tomcat manager credentials, and a 401 after 3 failed attempts logging in as test.
> 
> I wonder if my log4j file is right for debugging the realm?:
> 
> log4j.logger.org.apache.catalina.realm=DEBUG
> log4j.rootLogger=DEBUG, R
> log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.R.File=${catalina.base}/logs/sample.log
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.DatePattern='.'yyyy-MM-dd
> log4j.appender.R.layout.ConversionPattern=%d %-5p %c - %m%n
> 
> 
> 
> 
> 2008-03-12 12:18:52,292 DEBUG org.apache.commons.digester.Digester.sax - setDocumentLocator(org.apache.xerces.parsers.AbstractSAXParser$LocatorProxy@17b0998)
> 2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester.sax - startDocument()
> 2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester.sax - startElement(,,tomcat-users)
> 2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester -   Pushing body text ''
> 2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester -   New match='tomcat-users'
> 2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users'.
> 2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester.sax - characters(
>   )
> 2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester.sax - startElement(,,role)
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   Pushing body text '
>   '
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   New match='tomcat-users/role'
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users/role'.
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester.sax - endElement(,,role)
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   match='tomcat-users/role'
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   bodyText=''
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users/role'.
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   Popping body text '
>   '
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester.sax - characters(
>   )
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester.sax - startElement(,,role)
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   Pushing body text '
> 
>   '
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   New match='tomcat-users/role'
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users/role'.
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester.sax - endElement(,,role)
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   match='tomcat-users/role'
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   bodyText=''
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users/role'.
> 2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   Popping body text '
> 
>   '
> 2008-03-12 12:18:52,295 DEBUG org.apache.commons.digester.Digester.sax - characters(
>   )
> 2008-03-12 12:18:52,295 DEBUG org.apache.commons.digester.Digester.sax - startElement(,,role)
> 2008-03-12 12:18:52,295 DEBUG org.apache.commons.digester.Digester -   Pushing body text '
> 
> 
> 
> 
> 
> > On your realm up the level of debug and let us know whats in the logs
> > 
> > 
> > D
> > 
> > 
> > On Wed, 2008-03-12 at 11:16 +0000, Edward Quick wrote:
> > > Thanks David, I had forgotten the web.xml as you suggested. I have now added this so my web.xml is as shown below, and I get the prompt but the userid I'm using 'test' (passwd: test) isn't going through.
> > > Hope this isn't a daft question, but do I need to add code to the servlet to get this to work? Thanks for your help.
> > > 
> > > Ed.
> > > 
> > > 
> > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
> > >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> > >     version="2.4">
> > > 
> > >     <display-name>Hello, World Application</display-name>
> > >     <description>
> > >   This is a simple web application with a source code organization
> > >   based on the recommendations of the Application Developer's Guide.
> > >     </description>
> > > 
> > >     <servlet>
> > >         <servlet-name>HelloServlet</servlet-name>
> > >         <servlet-class>mypackage.Hello</servlet-class>
> > >     </servlet>
> > > 
> > >     <servlet-mapping>
> > >         <servlet-name>HelloServlet</servlet-name>
> > >         <url-pattern>/hello</url-pattern>
> > >     </servlet-mapping>
> > > 
> > >   <resource-env-ref>
> > >     <description>
> > >       Link to the UserDatabase instance from which we request lists of
> > >       defined role names.  Typically, this will be connected to the global
> > >       user database with a ResourceLink element in server.xml or the context
> > >       configuration file for the Manager web application.
> > >     </description>
> > >     <resource-env-ref-name>users</resource-env-ref-name>
> > >     <resource-env-ref-type>
> > >       org.apache.catalina.UserDatabase
> > >     </resource-env-ref-type>
> > >   </resource-env-ref>
> > > 
> > >   <security-constraint>
> > >     <web-resource-collection>
> > >       <web-resource-name>test</web-resource-name>
> > >       <url-pattern>/*</url-pattern>
> > >     </web-resource-collection>
> > >     <auth-constraint>
> > >        <!-- NOTE:  This role is not present in the default users file -->
> > >        <role-name>test</role-name>
> > >     </auth-constraint>
> > >   </security-constraint>
> > > 
> > >   <!-- Define the Login Configuration for this Application -->
> > >   <login-config>
> > >     <auth-method>BASIC</auth-method>
> > >     <realm-name>Tomcat Sample Application</realm-name>
> > >   </login-config>
> > > 
> > >   <!-- Security roles referenced by this web application -->
> > >   <security-role>
> > >     <description>
> > >       The role that is required to log in to the test application
> > >     </description>
> > >     <role-name>test</role-name>
> > >   </security-role>
> > > 
> > > </web-app>
> > > 
> > > 
> > > and /tmp/tomcatusers.xml is:
> > > 
> > > <?xml version='1.0' encoding='utf-8'?>
> > > <tomcat-users>
> > >   <role rolename="tomcat"/>
> > >   <role rolename="role1"/>
> > >   <role rolename="manager"/>
> > >   <role rolename="admin"/>
> > >   <user username="tomcat" password="tomcat" roles="tomcat"/>
> > >   <user username="both" password="tomcat" roles="tomcat,role1"/>
> > >   <user username="test" password="test" roles="test"/>
> > >   <user username="admin" password="tomcat" roles="admin"/>
> > > </tomcat-users>
> > > 
> > > 
> > > > 
> > > > whats in your web.xml ?
> > > > 
> > > > is your app forcing a login ?
> > > > 
> > > > all the realm provides is a system to do authentication
> > > > unless you are triggering it, it isn't used....
> > > > 
> > > > 
> > > > 
> > > > On Wed, 2008-03-12 at 10:36 +0000, Edward Quick wrote:
> > > > > Hi,
> > > > > 
> > > > > I would like to specify my own tomcat-users.xml for my webapp to use (not the server's main one in  conf/tomcat-user.xml).
> > > > > 
> > > > > I tried the following configuration in my webapp's context.xml file but unfortunately when I went to the URL, I wasn't even prompted for a logon:
> > > > > 
> > > > > <Context path="/sample" debug="0" privileged="true">
> > > > >         <Realm className="org.apache.catalina.realm.MemoryRealm" path="/tmp/tomcatusers.xml" />
> > > > > </Context>
> > > > > 
> > > > > Could someone tell me if this is possible, and if so what I need to do to set up the login prompt please?
> > > > > 
> > > > > Thanks,
> > > > > 
> > > > > Ed.
> > > > > 
> > > > > 
> > > > > 
> > > > > _________________________________________________________________
> > > > > Telly addicts unite!
> > > > > http://www.searchgamesbox.com/tvtown.shtml
> > > > 
> > > > 
> > > > ---------------------------------------------------------------------
> > > > To start a new topic, e-mail: users@tomcat.apache.org
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > 
> > > 
> > > _________________________________________________________________
> > > Telly addicts unite!
> > > http://www.searchgamesbox.com/tvtown.shtml
> > 
> > 
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> 
> _________________________________________________________________
> Telly addicts unite!
> http://www.searchgamesbox.com/tvtown.shtml

_________________________________________________________________
Get Hotmail on your mobile, text MSN to 63463!
http://mobile.uk.msn.com/pc/mail.aspx

RE: memoryrealm

Posted by Edward Quick <ed...@hotmail.com>.
I don't know if this helps, but here's an extract from the log below. This gets created at deployment, but when I visit the URL, I don't get any output.

Also I've determined now that the sample app is using conf/tomcat-users.xml and not my own /tmp/tomcatusers.xml file as I get a 403 returned when I put in the tomcat manager credentials, and a 401 after 3 failed attempts logging in as test.

I wonder if my log4j file is right for debugging the realm?:

log4j.logger.org.apache.catalina.realm=DEBUG
log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=${catalina.base}/logs/sample.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.DatePattern='.'yyyy-MM-dd
log4j.appender.R.layout.ConversionPattern=%d %-5p %c - %m%n




2008-03-12 12:18:52,292 DEBUG org.apache.commons.digester.Digester.sax - setDocumentLocator(org.apache.xerces.parsers.AbstractSAXParser$LocatorProxy@17b0998)
2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester.sax - startDocument()
2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester.sax - startElement(,,tomcat-users)
2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester -   Pushing body text ''
2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester -   New match='tomcat-users'
2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users'.
2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester.sax - characters(
  )
2008-03-12 12:18:52,293 DEBUG org.apache.commons.digester.Digester.sax - startElement(,,role)
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   Pushing body text '
  '
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   New match='tomcat-users/role'
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users/role'.
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester.sax - endElement(,,role)
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   match='tomcat-users/role'
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   bodyText=''
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users/role'.
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   Popping body text '
  '
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester.sax - characters(
  )
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester.sax - startElement(,,role)
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   Pushing body text '

  '
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   New match='tomcat-users/role'
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users/role'.
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester.sax - endElement(,,role)
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   match='tomcat-users/role'
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   bodyText=''
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   No rules found matching 'tomcat-users/role'.
2008-03-12 12:18:52,294 DEBUG org.apache.commons.digester.Digester -   Popping body text '

  '
2008-03-12 12:18:52,295 DEBUG org.apache.commons.digester.Digester.sax - characters(
  )
2008-03-12 12:18:52,295 DEBUG org.apache.commons.digester.Digester.sax - startElement(,,role)
2008-03-12 12:18:52,295 DEBUG org.apache.commons.digester.Digester -   Pushing body text '





> On your realm up the level of debug and let us know whats in the logs
> 
> 
> D
> 
> 
> On Wed, 2008-03-12 at 11:16 +0000, Edward Quick wrote:
> > Thanks David, I had forgotten the web.xml as you suggested. I have now added this so my web.xml is as shown below, and I get the prompt but the userid I'm using 'test' (passwd: test) isn't going through.
> > Hope this isn't a daft question, but do I need to add code to the servlet to get this to work? Thanks for your help.
> > 
> > Ed.
> > 
> > 
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> >     version="2.4">
> > 
> >     <display-name>Hello, World Application</display-name>
> >     <description>
> >   This is a simple web application with a source code organization
> >   based on the recommendations of the Application Developer's Guide.
> >     </description>
> > 
> >     <servlet>
> >         <servlet-name>HelloServlet</servlet-name>
> >         <servlet-class>mypackage.Hello</servlet-class>
> >     </servlet>
> > 
> >     <servlet-mapping>
> >         <servlet-name>HelloServlet</servlet-name>
> >         <url-pattern>/hello</url-pattern>
> >     </servlet-mapping>
> > 
> >   <resource-env-ref>
> >     <description>
> >       Link to the UserDatabase instance from which we request lists of
> >       defined role names.  Typically, this will be connected to the global
> >       user database with a ResourceLink element in server.xml or the context
> >       configuration file for the Manager web application.
> >     </description>
> >     <resource-env-ref-name>users</resource-env-ref-name>
> >     <resource-env-ref-type>
> >       org.apache.catalina.UserDatabase
> >     </resource-env-ref-type>
> >   </resource-env-ref>
> > 
> >   <security-constraint>
> >     <web-resource-collection>
> >       <web-resource-name>test</web-resource-name>
> >       <url-pattern>/*</url-pattern>
> >     </web-resource-collection>
> >     <auth-constraint>
> >        <!-- NOTE:  This role is not present in the default users file -->
> >        <role-name>test</role-name>
> >     </auth-constraint>
> >   </security-constraint>
> > 
> >   <!-- Define the Login Configuration for this Application -->
> >   <login-config>
> >     <auth-method>BASIC</auth-method>
> >     <realm-name>Tomcat Sample Application</realm-name>
> >   </login-config>
> > 
> >   <!-- Security roles referenced by this web application -->
> >   <security-role>
> >     <description>
> >       The role that is required to log in to the test application
> >     </description>
> >     <role-name>test</role-name>
> >   </security-role>
> > 
> > </web-app>
> > 
> > 
> > and /tmp/tomcatusers.xml is:
> > 
> > <?xml version='1.0' encoding='utf-8'?>
> > <tomcat-users>
> >   <role rolename="tomcat"/>
> >   <role rolename="role1"/>
> >   <role rolename="manager"/>
> >   <role rolename="admin"/>
> >   <user username="tomcat" password="tomcat" roles="tomcat"/>
> >   <user username="both" password="tomcat" roles="tomcat,role1"/>
> >   <user username="test" password="test" roles="test"/>
> >   <user username="admin" password="tomcat" roles="admin"/>
> > </tomcat-users>
> > 
> > 
> > > 
> > > whats in your web.xml ?
> > > 
> > > is your app forcing a login ?
> > > 
> > > all the realm provides is a system to do authentication
> > > unless you are triggering it, it isn't used....
> > > 
> > > 
> > > 
> > > On Wed, 2008-03-12 at 10:36 +0000, Edward Quick wrote:
> > > > Hi,
> > > > 
> > > > I would like to specify my own tomcat-users.xml for my webapp to use (not the server's main one in  conf/tomcat-user.xml).
> > > > 
> > > > I tried the following configuration in my webapp's context.xml file but unfortunately when I went to the URL, I wasn't even prompted for a logon:
> > > > 
> > > > <Context path="/sample" debug="0" privileged="true">
> > > >         <Realm className="org.apache.catalina.realm.MemoryRealm" path="/tmp/tomcatusers.xml" />
> > > > </Context>
> > > > 
> > > > Could someone tell me if this is possible, and if so what I need to do to set up the login prompt please?
> > > > 
> > > > Thanks,
> > > > 
> > > > Ed.
> > > > 
> > > > 
> > > > 
> > > > _________________________________________________________________
> > > > Telly addicts unite!
> > > > http://www.searchgamesbox.com/tvtown.shtml
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To start a new topic, e-mail: users@tomcat.apache.org
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > 
> > 
> > _________________________________________________________________
> > Telly addicts unite!
> > http://www.searchgamesbox.com/tvtown.shtml
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Telly addicts unite!
http://www.searchgamesbox.com/tvtown.shtml

RE: memoryrealm

Posted by David Cassidy <da...@twocats.co.uk>.
On your realm up the level of debug and let us know whats in the logs


D


On Wed, 2008-03-12 at 11:16 +0000, Edward Quick wrote:
> Thanks David, I had forgotten the web.xml as you suggested. I have now added this so my web.xml is as shown below, and I get the prompt but the userid I'm using 'test' (passwd: test) isn't going through.
> Hope this isn't a daft question, but do I need to add code to the servlet to get this to work? Thanks for your help.
> 
> Ed.
> 
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>     version="2.4">
> 
>     <display-name>Hello, World Application</display-name>
>     <description>
>   This is a simple web application with a source code organization
>   based on the recommendations of the Application Developer's Guide.
>     </description>
> 
>     <servlet>
>         <servlet-name>HelloServlet</servlet-name>
>         <servlet-class>mypackage.Hello</servlet-class>
>     </servlet>
> 
>     <servlet-mapping>
>         <servlet-name>HelloServlet</servlet-name>
>         <url-pattern>/hello</url-pattern>
>     </servlet-mapping>
> 
>   <resource-env-ref>
>     <description>
>       Link to the UserDatabase instance from which we request lists of
>       defined role names.  Typically, this will be connected to the global
>       user database with a ResourceLink element in server.xml or the context
>       configuration file for the Manager web application.
>     </description>
>     <resource-env-ref-name>users</resource-env-ref-name>
>     <resource-env-ref-type>
>       org.apache.catalina.UserDatabase
>     </resource-env-ref-type>
>   </resource-env-ref>
> 
>   <security-constraint>
>     <web-resource-collection>
>       <web-resource-name>test</web-resource-name>
>       <url-pattern>/*</url-pattern>
>     </web-resource-collection>
>     <auth-constraint>
>        <!-- NOTE:  This role is not present in the default users file -->
>        <role-name>test</role-name>
>     </auth-constraint>
>   </security-constraint>
> 
>   <!-- Define the Login Configuration for this Application -->
>   <login-config>
>     <auth-method>BASIC</auth-method>
>     <realm-name>Tomcat Sample Application</realm-name>
>   </login-config>
> 
>   <!-- Security roles referenced by this web application -->
>   <security-role>
>     <description>
>       The role that is required to log in to the test application
>     </description>
>     <role-name>test</role-name>
>   </security-role>
> 
> </web-app>
> 
> 
> and /tmp/tomcatusers.xml is:
> 
> <?xml version='1.0' encoding='utf-8'?>
> <tomcat-users>
>   <role rolename="tomcat"/>
>   <role rolename="role1"/>
>   <role rolename="manager"/>
>   <role rolename="admin"/>
>   <user username="tomcat" password="tomcat" roles="tomcat"/>
>   <user username="both" password="tomcat" roles="tomcat,role1"/>
>   <user username="test" password="test" roles="test"/>
>   <user username="admin" password="tomcat" roles="admin"/>
> </tomcat-users>
> 
> 
> > 
> > whats in your web.xml ?
> > 
> > is your app forcing a login ?
> > 
> > all the realm provides is a system to do authentication
> > unless you are triggering it, it isn't used....
> > 
> > 
> > 
> > On Wed, 2008-03-12 at 10:36 +0000, Edward Quick wrote:
> > > Hi,
> > > 
> > > I would like to specify my own tomcat-users.xml for my webapp to use (not the server's main one in  conf/tomcat-user.xml).
> > > 
> > > I tried the following configuration in my webapp's context.xml file but unfortunately when I went to the URL, I wasn't even prompted for a logon:
> > > 
> > > <Context path="/sample" debug="0" privileged="true">
> > >         <Realm className="org.apache.catalina.realm.MemoryRealm" path="/tmp/tomcatusers.xml" />
> > > </Context>
> > > 
> > > Could someone tell me if this is possible, and if so what I need to do to set up the login prompt please?
> > > 
> > > Thanks,
> > > 
> > > Ed.
> > > 
> > > 
> > > 
> > > _________________________________________________________________
> > > Telly addicts unite!
> > > http://www.searchgamesbox.com/tvtown.shtml
> > 
> > 
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> 
> _________________________________________________________________
> Telly addicts unite!
> http://www.searchgamesbox.com/tvtown.shtml


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: memoryrealm

Posted by Edward Quick <ed...@hotmail.com>.
Thanks David, I had forgotten the web.xml as you suggested. I have now added this so my web.xml is as shown below, and I get the prompt but the userid I'm using 'test' (passwd: test) isn't going through.
Hope this isn't a daft question, but do I need to add code to the servlet to get this to work? Thanks for your help.

Ed.


<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <display-name>Hello, World Application</display-name>
    <description>
  This is a simple web application with a source code organization
  based on the recommendations of the Application Developer's Guide.
    </description>

    <servlet>
        <servlet-name>HelloServlet</servlet-name>
        <servlet-class>mypackage.Hello</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>HelloServlet</servlet-name>
        <url-pattern>/hello</url-pattern>
    </servlet-mapping>

  <resource-env-ref>
    <description>
      Link to the UserDatabase instance from which we request lists of
      defined role names.  Typically, this will be connected to the global
      user database with a ResourceLink element in server.xml or the context
      configuration file for the Manager web application.
    </description>
    <resource-env-ref-name>users</resource-env-ref-name>
    <resource-env-ref-type>
      org.apache.catalina.UserDatabase
    </resource-env-ref-type>
  </resource-env-ref>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>test</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
       <!-- NOTE:  This role is not present in the default users file -->
       <role-name>test</role-name>
    </auth-constraint>
  </security-constraint>

  <!-- Define the Login Configuration for this Application -->
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Tomcat Sample Application</realm-name>
  </login-config>

  <!-- Security roles referenced by this web application -->
  <security-role>
    <description>
      The role that is required to log in to the test application
    </description>
    <role-name>test</role-name>
  </security-role>

</web-app>


and /tmp/tomcatusers.xml is:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager"/>
  <role rolename="admin"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="test" password="test" roles="test"/>
  <user username="admin" password="tomcat" roles="admin"/>
</tomcat-users>


> 
> whats in your web.xml ?
> 
> is your app forcing a login ?
> 
> all the realm provides is a system to do authentication
> unless you are triggering it, it isn't used....
> 
> 
> 
> On Wed, 2008-03-12 at 10:36 +0000, Edward Quick wrote:
> > Hi,
> > 
> > I would like to specify my own tomcat-users.xml for my webapp to use (not the server's main one in  conf/tomcat-user.xml).
> > 
> > I tried the following configuration in my webapp's context.xml file but unfortunately when I went to the URL, I wasn't even prompted for a logon:
> > 
> > <Context path="/sample" debug="0" privileged="true">
> >         <Realm className="org.apache.catalina.realm.MemoryRealm" path="/tmp/tomcatusers.xml" />
> > </Context>
> > 
> > Could someone tell me if this is possible, and if so what I need to do to set up the login prompt please?
> > 
> > Thanks,
> > 
> > Ed.
> > 
> > 
> > 
> > _________________________________________________________________
> > Telly addicts unite!
> > http://www.searchgamesbox.com/tvtown.shtml
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Telly addicts unite!
http://www.searchgamesbox.com/tvtown.shtml

Re: memoryrealm

Posted by David Cassidy <da...@twocats.co.uk>.
whats in your web.xml ?

is your app forcing a login ?

all the realm provides is a system to do authentication
unless you are triggering it, it isn't used....



On Wed, 2008-03-12 at 10:36 +0000, Edward Quick wrote:
> Hi,
> 
> I would like to specify my own tomcat-users.xml for my webapp to use (not the server's main one in  conf/tomcat-user.xml).
> 
> I tried the following configuration in my webapp's context.xml file but unfortunately when I went to the URL, I wasn't even prompted for a logon:
> 
> <Context path="/sample" debug="0" privileged="true">
>         <Realm className="org.apache.catalina.realm.MemoryRealm" path="/tmp/tomcatusers.xml" />
> </Context>
> 
> Could someone tell me if this is possible, and if so what I need to do to set up the login prompt please?
> 
> Thanks,
> 
> Ed.
> 
> 
> 
> _________________________________________________________________
> Telly addicts unite!
> http://www.searchgamesbox.com/tvtown.shtml


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org