tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <dmik...@gopivotal.com>
Subject Re: configuring a combined realm
Date Tue, 01 Apr 2014 12:52:51 GMT
On Apr 1, 2014, at 8:15 AM, Francesco Viscomi <fviscomi@gmail.com> wrote:

> I'm unable to understand what's wrong with this configuration:

Can you be more specific about what is and isn’t working with the setup?  As I understand
it, you’re trying to setup container based authentication for the manager app and for your
custom app.  Is authentication working for either of them?  If not, what happens when you
try to auth?  Are you presented with the opportunity to login or do you just get access to
everything?  If you are give the chance to login, does a login attempt with a valid user fail?
 If so, are you presented with any error messages?

Also, please include the exact version of Tomcat that you’re running.

> 
> in the server.xml file I defined that as a resource i want to use
> conf/tomcat-users.xml (this authentication is just for tomcat manager);
> While to authenticated user on my application i define in the context.xml
> file as a realm a database;
> In other words I don't want to modify server.xml file to make
> authentication on my app;
> 
> 
> server.xml  file:
> ========================================================================================
> <?xml version='1.0' encoding='utf-8'?>
> <Server port="8005" shutdown="SHUTDOWN">
>    <Listener className="org.apache.catalina.core.AprLifecycleListener"
> SSLEngine="on" />
>    <Listener className="org.apache.catalina.core.JasperListener" />
>    <Listener
> className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
>    <Listener
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
>    <Listener
> className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
> 
> 
>    <GlobalNamingResources>
>        <Resource name="UserDatabase" auth="Container"
>            type="org.apache.catalina.UserDatabase"
>            description="User database that can be updated and saved"
>            factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>            pathname="conf/tomcat-users.xml" />
> 
>    </GlobalNamingResources>
> 
> 
> 
>    <Service name="Catalina">
>        <Connector port="8080" protocol="HTTP/1.1"
>            connectionTimeout="20000"
>            redirectPort="8443" />
>        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
>        <Engine name="Catalina" defaultHost="localhost">
>            <Host name="localhost"  appBase="webapps" unpackWARs="true"
> autoDeploy="true">
> 
>                <Realm
> className="org.apache.catalina.realm.UserDatabaseRealm"
>                    resourceName="UserDatabase"/>
> 
>                <Valve
> className="org.apache.catalina.valves.AccessLogValve" directory="logs"
>                    prefix="localhost_access_log." suffix=".txt"
>                    pattern="%h %l %u %t &quot;%r&quot; %s %b" />
>            </Host>
>        </Engine>
>    </Service>
> </Server>
> 
> ====================================================================================
> 
> context.xml file

What file is this?  “conf/context.xml?  If so, I would not suggest putting this configuration
there.  It’s settings will be applied to all applications deployed to your server, probably
not what you want and possibly even why you’re seeing problems here.

> ===============================================================================
> <?xml version="1.0" encoding="UTF-8"?>
> <Context antiJARLocking="true" path="/SitoAziendale”>

Specifying a “path” here is wrong.  You can only set “path” if you’re defining a
context in server.xml (which is not a good practice anyway).  In all other cases, the path
will be inferred.

Dan

>    <Resource name="jdbc/PoolConnessioni" auth="Container"
> type="javax.sql.DataSource"
>        maxActive="100" maxIdle="30" maxWait="10000"
>        username="utentedb" password="utentedb"
> driverClassName="com.mysql.jdbc.Driver"
> 
> url="jdbc:mysql://localhost:3306/timesheet?zeroDateTimeBehavior=convertToNull"/>
> 
> 
> 
>    <Realm className="org.apache.catalina.realm.DataSourceRealm"
>        dataSourceName="jdbc/PoolConnessioni"
>        userTable="Dipendente" userNameCol="username" userCredCol="password"
>        userRoleTable="ruoliUtente" roleNameCol="nomeRuolo"/>
> 
> 
> </Context>
> 
> ========================================================================================
> 
> thanks;


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


Mime
View raw message