1
I’m using the JAAS
for the safety of my webapp.
I declare only one JDBCRealm
of the normal Tomcat, passing the bank credentials... follows the context.xml
with the Declaration of the Realm:
xml context.
<?xml version='1.0' encoding='utf-8'?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
connectionURL="jdbc:sqlserver://ip:porta;databaseName=dbname;user=user;password=pass"
userTable="user" userNameCol="username" userCredCol="pass"
userRoleTable="roles" roleNameCol="rolename"
digest="SHA-256"/>
</Context>
Installing the Tomcat 7 in my folder and placing this context.xml in the folder TOMCAT7/conf/context.xml
and putting the sql server lib in the folder TOMCAT7/lib,
authentication with the JAAS
works normal.
When trying to use the Maven plugin, authentication does not work. I did it this way:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>9090</port>
<path>/</path>
<contextFile>src/main/resources/tomcat/context.xml</contextFile>
</configuration>
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>${mssql-jdbc.version}</version>
</dependency>
</dependencies>
</plugin>
I put the same **context.xml ** in the src/main/Resources/Tomcat/context.xml folder