Hi
Thank you for reading my post
i have problem with tomcat JDBC realm
I defined a jdbc realm in server.xml also i configured my application to
use Realms
but it never login into system ,it always send me to login_error page
instead of logging in to the syste.
I should say that when i creaete my own realm in server.xml ,i can not
login into admin console anymore.
are these two relevant ?
should i comment or uncomment more stuff in server.xml ?
how an application knows which realm it should use ?
another question that i have is about users / users_role / roles tables
should i create all these tables ?my users allways has one role , so i
create one table and
it contains also role column , i mapped these in server.xml .
can it be a problem for tomcat ? is it manedatory to use 3 tables ?
I attached my web.xml section that is related to security and also
server.xml section that is related to security and realms
I should say that i double check JDBC driver to be in place , double
check connection url ...
thank you very much.
-----------------------web.xml begin-------------------------
<security-constraint>
<web-resource-collection>
<web-resource-name>all</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>manager</role-name>
<role-name>user</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/login_error.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>manager</role-name>
</security-role>
<security-role>
<role-name>user</role-name>
</security-role>
--------------------------server.xml---------------------------
<!-- Because this Realm is here, an instance will be shared
globally -->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<!--
by masoud
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
-->
<!-- Comment out the old realm but leave here for now in case we
need to go back quickly -->
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
<!-- Replace the above Realm with one of the following to get a Realm
stored in a database and accessed via JDBC -->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/authority"
connectionName="test" connectionPassword="test"
userTable="users" userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:ftdb"
connectionName="hr" connectionPassword="hr"
userTable="users" userNameCol="username"
userCredCol="password"
userRoleTable="users" roleNameCol="role_name" />
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:CATALINA"
userTable="users" userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
---------------------------Database table structure---------------
CREATE TABLE "HR"."USERS"
( "NAME" VARCHAR2(32 CHAR),
"USER_ID" NUMBER,
"LASTNAME" VARCHAR2(32 CHAR),
"USERNAME" VARCHAR2(32 CHAR),
"PASSWORD" VARCHAR2(32 CHAR),
"ROLE_NAME" VARCHAR2(128 CHAR),
CONSTRAINT "USERS_PK" PRIMARY KEY ("USER_ID") ENABLE
) ;
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]