I'm using JAAS
for the security of my webapp .
I only declare a JDBCRealm
of normal Tomcat, passing the bank credentials ... it follows context.xml
with the declaration of Realm:
context.xml
<?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 Tomcat 7 in my folder and placing this context.xml in the TOMCAT7/conf/context.xml
folder and placing the sql server lib in the TOMCAT7/lib,
folder authentication with JAAS
works normal.
When you try to use the maven plugin, authentication does not work. I did this:
<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 placed the same ** context.xml ** in the src / main / resources / tomcat / context.xml folder