我在尝试使用<intercept-url ... requires-channel="https"/>
重定向到https时出现问题,我在浏览器控制台中收到错误消息:
"GET https://localhost:8443/xxx/authenticate.htmnet::ERR_CONNECTION_REFUSED"
spring-security.xml包含:
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/authenticate.htm" access="hasAnyRole('ROLE_USER','ROLE_ADMIN')" requires-channel="https"/>
<form-login login-page="/index.htm" default-target-url="/authenticate.htm"
authentication-failure-url="/loginfailed.htm" username-parameter="j_username"
password-parameter="j_password" />
<!-- <session-management invalid-session-url="/loginfailed.htm"> <concurrency-control
error-if-maximum-exceeded="true" max-sessions="1"> </concurrency-control>
</session-management> -->
<logout invalidate-session="false" logout-success-url="/index.htm" />
<port-mappings>
<port-mapping http="8080" https="443"/>
</port-mappings>
</http>
我的logincontroller包含:
@RequestMapping(value = "/authenticate.htm", method = RequestMethod.GET)
public String autenticate(Model model, HttpSession session){
model.addAttribute("msg", "Successfully logged in");
return "success";
}
我的代码有问题吗?请提出解决此问题的方法。
感谢您的帮助。