I hope that some one can help me. I try to configure the authentification via a JDBCRealm. It is the first time do this.
Here are my Tables:
*Table userprincipal*
email : varchar
password : varchar
*Table role*
email : varchar
role : varchar
I use a Tomcat 7 Server. So i changed the server.xml from
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
to (with correct login data)
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/myData"
connectionName="user"
connectionPassword="pwd"
userTable="userprincipal"
userNameCol="EMAIL"
userCredCol="password"
userRoleTable="userprincipal_role"
roleNameCol="role" />
I added to the web.xml following lines
<security-constraint>
<web-resource-collection>
<web-resource-name>Default</web-resource-name>
<url-pattern>/services/customer/*</url-pattern>
<url-pattern>/services/material/loadAllByQuery</url-pattern>
<url-pattern>/services/SalesOrder/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>user</role-name>
</security-role>
When I start the Application and I call a URL which only admins and users can access I get the login popup from the browser. But if I logged in with correct user data the popup comes again. Other pages without a login working fine.
There are no exceptions, no warnings, no other erros displayed in the console.
How can I figured out whats the problem?
SDK is Java 1.7
Tomcat version is 7.0
It looks like the problem is the Tomcat installation. I installed it via Eclipse. Now I installed it manually und deployed the war file of my project. It works.