Jose is correct
did you implement these steps from the documentation:
http://tomcat.apache.org/tomcat-7.0-doc/funcspecs/fs-jdbc-realm.html
Acquire the one and only connection [Current] or acquire a connection
        from the connection pool [Requested].
MG>do you have a valid connection handle?

Select the one and only row from the user's table for this user,
        and retrieve the corresponding password column.  If zero rows (or
        more than one row) are found, return null.
MG>do you have the password retrieved from users table that corresponds to 
username?

Authenticate the user by comparing the (possibly encrypted) password
        value that was received against the password presented by the user.
        If there is no match, return null.
MG>do the passwords match?

Acquire a List of the security roles assigned to the
        authenticated user by selecting from the roles table.
MG>do you have a list of roles from the roles table corresponding to the 
supplied username?

Construct a new instance of class
        org.apache.catalina.realm.GenericPrincipal, passing as
        constructor arguments:  this realm instance, the authenticated
        username, and a List of the security roles associated
        with this user.
MG>are you able to construct GenericPrincipal object?

WARNING - Do not attempt to cache and reuse previous
        GenericPrincipal objects for a particular user, because
        the information in the directory server might have changed since the
        last time this user was authenticated.Return the newly constructed 
GenericPrincipal.
Buena Suerte,
Martin 
______________________________________________ 
Porfavor..no altere ni interrumptir esta communicacion..Gracias


> Date: Sat, 29 Sep 2012 01:57:20 -0700
> From: boudali.souh...@gmail.com
> To: users@tomcat.apache.org
> Subject: Problems with Realm
> 
> Hello Tomcatters,
> 
> I am beginner in development, I wanted to do the user authentication, I am I
> followed a tutorial for it to the letter, but in the final step I fell into
> a problem that I did not arrive for a week of web search to solve it
> -- after login he goes search on the database and when it's a fake login or
> passe  he derige me to the error page<form-error-page> but when the password
> and login are correct i get HTTP 403 and that is my problem it does not
> Derige me to my desired page
> 
> brief  all I've done is
> >> in web.xml
> 
>   <security-constraint>
>        <display-name>AdminConstraint</display-name>
>        <web-resource-collection>
>            <web-resource-name>Admin</web-resource-name>
>            <description>Only for administrators</description>
>            <url-pattern>/pages/protected/admin/*</url-pattern>
>        </web-resource-collection>
>        <auth-constraint>
>            <role-name>ADMIN</role-name>
>            </auth-constraint>
>    </security-constraint> 
>     <login-config>
>     <auth-method>FORM</auth-method>
>     <form-login-config>
>       <form-login-page>/pages/public/login.xhtml</form-login-page>
>       <form-error-page>/pages/public/loginError.xhtml</form-error-page>
>     </form-login-config>
>   </login-config>
>    <security-role>
>        <role-name>ADMIN</role-name>
>    </security-role>
> 
> >> in server.xml 
> 
> <Context path="/myapp" docBase="myapp" >
> <Realm className="org.apache.catalina.realm.JDBCRealm"
> driverName="com.mysql.jdbc.Driver"
> connectionURL="jdbc:mysql://localhost:3306/mabase" userTable="users"
> userNameCol="name" userCredCol="pass" userRoleTable="user_roles"
> connectionName="tomcat" connectionPassword="TomcatPassword"
> roleNameCol="role_name" debug="99" />
> </Context>
> 
> 
> *where is the error?? is what I need to add anything else??*
> 
> 
> 
> --
> View this message in context: 
> http://tomcat.10.n6.nabble.com/Problems-with-Realm-tp4987265.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
                                          

Reply via email to