Wednesday, 15 June 2011

authentication - How the j_security_check validates the user ? I want to remove the default and keep it for ldap authenication -



authentication - How the j_security_check validates the user ? I want to remove the default and keep it for ldap authenication -

i using j_security_check in web application using jetty. below form in jsp file.

<form action="/j_security_check" method="post"> <table> <tr>username:<input type="text" name="j_username"/></tr> <tr>password:<input type="password" name="j_password"/></tr> <tr><input type="submit" value="login"/></tr> </table> </form>

actually trying authenticate user ldap server. first time, when seek authenticate, logging in directly. after when seek access credentials, logging in directly.

i not sure j_security_check keeps username , password, each time when tries authenticate or validate. ideas in regard.

the below web.xml code kept form based authentication reference.

form

<!-- note, needs match whats in adminwebapplauncher --> <realm-name>myrealm</realm-name> <form-login-config> <form-login-page>/login.html</form-login-page> <form-error-page>/loginerror.html</form-error-page> </form-login-config> </login-config> <security-role> <role-name>admin</role-name> </security-role>

any thought on this. please suggest..!

you need create 2 table in database first 1 contains username , password , sec 1 contains username , role. alternative create 1 table contains username, password and, role.

also should add together next xml tags server.xml or context.xml:

<realm classname="org.apache.catalina.realm.jdbcrealm" drivername="com.mysql.jdbc.driver" connectionurl="jdbc:mysql://localhost/test" connectionname="root" connectionpassword="password" usertable="user" usernamecol="user_name" usercredcol="user_pass" userroletable="user_role_link" rolenamecol="role_id" />

authentication j-security-check

No comments:

Post a Comment