Spring 3.0安全性http GET登录

编程入门 行业动态 更新时间:2024-10-27 14:23:37
本文介绍了Spring 3.0安全性http GET登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有以下spring安全配置,我如何更改为基于http GET而不是POST登录工作,以便登录url将如下所示: * http: //localhost/myapp/j_security_check?j_username=scott&j_password=tiger&landing=some.html *

I have following spring security configuration, How do i change to it login to work based on http GET instead of POST, so that login url will be something like: *localhost/myapp/j_security_check?j_username=scott&j_password=tiger&landing=some.html*

<http auto-config="true" lowercase-comparisons="false"> <intercept-url pattern="/images/**" filters="none"/> <intercept-url pattern="/styles/**" filters="none"/> <intercept-url pattern="/scripts/**" filters="none"/> <!-- Temp Below for testing reports --> <intercept-url pattern="/admin/**" access="ROLE_ADMIN"/> <intercept-url pattern="/passwordHint*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/> <intercept-url pattern="/signup*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/> <intercept-url pattern="/unauthorized*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/> <intercept-url pattern="/**/*.action*" access="ROLE_ADMIN,ROLE_USER"/> <logout success-handler-ref="logoutHandler" invalidate-session="true" logout-url="/logout"/> <form-login login-page="/login" authentication-success-handler-ref="authSuccessHandler" authentication-failure-handler-ref="authFailureHandler" authentication-failure-url="/login?error=true" login-processing-url="/j_security_check"/> <remember-me user-service-ref="userDao" key="e37f4b31-0c45-11dd-bd0b-0800200c9a66"/> </http>

推荐答案

我最终在jquery submit中引入了额外的静态jsp页面form to j_security_check

I end up introducing additional static jsp page with jquery submit form to j_security_check

<script type="text/javascript"> $(function() { function getUrlParams() { var params = {}; window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(str, key, value) { params[key] = value; }); return params; } $('#j_username').val(getUrlParams()['user']); $('#j_password').val(getUrlParams()['password']); $('#urlLoginForm').submit(); }); </script> </head> <form method="post" id="urlLoginForm" action="<c:url value='/j_security_check'/>"> <input type="hidden" id="j_username" name="j_username" /> <input type="hidden" id="j_password" name="j_password" /> </form>

更多推荐

Spring 3.0安全性http GET登录

本文发布于:2023-10-09 16:55:30,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:安全性   Spring   http

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!