0
我使用了spring security 3,我決定將它升級到Spring security 4,當我這樣做時我面臨一個問題。問題是,當我從登錄表單將我的用戶名和密碼發佈到我的自定義userDetailService時,用戶名爲空。用戶名爲null spring security 4
<form action="<c:url value='/j_spring_security_check' />"
method='POST' id="login-form1" class="smart-form client-form" enctype="multipart/form-data" >
.
.
.
<section>
<label class="label">email</label>
<label class="input"> <i class="icon-append fa fa-user"></i>
<input type="text" name="username" id="username" data-parsley-trigger="change" required="">
<b class="tooltip tooltip-top-right"><i class="fa fa-user txt-color-teal"></i> enter email</b></label>
</section>
<section>
<label class="label">password</label>
<label class="input"> <i class="icon-append fa fa-lock"></i>
<input type="password" name="password" id="password">
<b class="tooltip tooltip-top-right"><i class="fa fa-lock txt-color-teal"></i> password</b> </label>
<div class="note">
<a href="forgotpassword.html">forgot password</a>
</div>
</section>
,這裏是我的彈簧security.xml文件
<security:intercept-url pattern="/view/login.jsp*" access="permitAll" />
<security:intercept-url pattern="/view/**" access="hasRole('ROLE_USER')" />
<security:intercept-url pattern="/rest/**" access="hasRole('ROLE_USER')" />
<security:form-login login-page="/view/login.jsp"
login-processing-url="/j_spring_security_check"
default-target-url="/view/homepage.jsp"
password-parameter="password"
username-parameter="username"/>
謝謝你的回答,問題解決 –
歡迎您。你選擇了什麼選項?如果它能解決你的問題,最終也會接受答案。 –