Ok I got it... In the web.xml you need this reference

<web-resource-name>MyFooRealm</web-resource-name>


And in your realm you need to give it an app name. <context....> <Realm ....
appName="MyFooRealm"/> </context>


-----Original Message-----
From: James Reynolds [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 03, 2006 7:16 PM
To: Tomcat Users List [EMAIL PROTECTED]
Subject: RE: Testing DataSourceRealms

response inline...


-----Original Message-----
From: Alex Jalali [mailto:[EMAIL PROTECTED]
Sent: Fri 3/3/2006 4:09 PM
To: Tomcat Users List
Subject: Re: Testing DataSourceRealms
 
>
> I'm working on setting up BASIC authentication using container managed 
> security in Tomcat 5.5.15.  However, It's not working so now I'm 
> wondering if my set up is wrong.  The JNDI DataSource definitely 
> works, I'm not so sure about the realm.  Is there another way to test it?
> Would you mind looking at my configuration files?
>
> This is what I have so far:
>
> *Context.xml*
>
> <?xml version="1.0" encoding="UTF-8"?> <Context path="/npp">
>     <Resource name="jdbc/NppDB" auth="Container"
>     type="javax.sql.DataSource"
> driverClassName="oracle.jdbc.driver.OracleDriver"
>     url="jdbc:oracle:thin:@server:1521:SID"
>     username="scott" password="tiger" maxActive="20" maxIdle="10"
>     removeAbandoned="true"
>     logAbandoned="true"
>     maxWait="-1"/>
>
>     <Realm className="org.apache.catalina.realm.DataSourceRealm"
> debug="99"
>     dataSourceName="jdbc/NppDB"
>     userTable="NPPUSER" userNameCol="EMAIL" userCredCol="PASSWORD"
>     userRoleTable="USER_ROLE" roleNameCol="ROLE"/> </Context>
>
> *web.xml*
> ...
> <resource-ref>
>         <res-ref-name>jdbc/NppDB</res-ref-name>
>         <res-type>javax.sql.DataSource</res-type>
>         <res-auth>Container</res-auth>
>         <res-sharing-scope>Shareable</res-sharing-scope>
>     </resource-ref>
>
>     <security-constraint>
>         <web-resource-collection>
>             <web-resource-name>
>                 The whole site
>             </web-resource-name>
>             <url-pattern>/*</url-pattern>
>             <http-method>POST</http-method>
>             <http-method>GET</http-method>
>         </web-resource-collection>
>         <auth-constraint>
>             <role-name>member</role-name>
>         </auth-constraint>
>     </security-constraint>
>
>     <security-role>
>         <role-name>member</role-name>
>     </security-role>
>
>     <security-role>
>         <role-name>vendor</role-name>
>     </security-role>
>
>     <login-config>
>         <auth-method>BASIC</auth-method>
>         <realm-name>NPP</realm-name>


Maybe I am wrong on this but I think this should be
<realm-name>org.apache.catalina.realm.DataSourceRealm</realm-name>

you reference NPP but I don't see that name in your realm


That's what I thought at first.  However, it turns out that the <realm-name>
contains the descriptive text that shows up in the browser's popup dialog.

>     </login-config>
> ...
> *end web.xml*
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to