/j_security_check adresi Servlet API tarafından tanımlı. Bu adrese Post isteği gönderilerek Form Login yapılabilir.
Örnek
web.xml şöyle olsun
<welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <login-config><auth-method>FORM</auth-method><realm-name>myrealm</realm-name><form-login-config><form-login-page>/login.jsp</form-login-page><form-error-page>/login_error.jsp</form-error-page></form-login-config></login-config>
login.jsp şöyle olsun
<form role="form" action="j_security_check" method="post" name="frmLogin" accept-charset="utf-8"> <input class="form-control" placeholder="Username" name="j_username" type="username" type="text" autofocus> <input class="form-control" placeholder="Password" name="j_password" type="password" value=""> <input name="Reset" type="reset" class="btn btn-default" value="Reset" id="btnReset" /> <input name="Login" type="submit" class="btn btn-primary" value="Login" id="btnLogin" /> </form>
standalone-full-ha.xml şöyle olsunn
<security-domain name="railway" cache-type="default"> <authentication> <login-module code="Database" flag="required"> <module-option name="dsJndiName" value="java:/railwayDS"/> <module-option name="hashAlgorithm" value="SHA-1"/> <module-option name="hashEncoding" value="hex"/> <module-option name="principalsQuery" value="SELECT passwd FROM USER WHERE username=?"/> <module-option name="rolesQuery" value="SELECT GR.ROLENAME, 'Roles' from ROLE GR INNER JOIN USER GU ON GR.USER_ID = GU.USER_ID WHERE GU.USERNAME=?"/> <module-option name="unauthenticatedIdentity" value="batchUser"/> </login-module> </authentication> </security-domain>
Hiç yorum yok:
Yorum Gönder