ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Using Tomcat 4 Security Realms
Subject:   Error when entering username and password
Date:   2003-03-26 13:09:53
From:   anonymous2
Good article, but as a complete novis on the subject I need some help.


I have a MSAccess Database with a User, Role and User_Role table as the article said. I get the login dialog to pop up but when I enter a username and password (that of course are in the User table and are mapped to the role in the User_Role table) nothing happens. After 3 tries I get an error page saying "This request requires HTTP authentication ()". What is wrong?


Here is what I enterd in server.xml and web.xml:


server.xml:
<realm classname="org.apache.catalina.realm.JDBCRealm" debug="99"
drivername="sun.jdbc.odbc.JdbcOdbcDriver"
connectionurl="jdbc:odbc://localhost/SWE11" connectionname=""
connectionpassword=""
usertable="User" usernamecol="UserName" usercredcol="Password"
userroletable="User_Role" rolenamecol="RoleName"/>


web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>MyApp Online</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>MyApp Online</realm-name>
</login-config>