我使用Spring安全,并能够通过我的客户页面logIn与method="post“,但没有method=" get ",我需要通过method="get”获得登录,这样就没有人可以看到我的密码在查看源代码。

任何帮助都将不胜感激。
发布于 2015-05-22 18:06:15
要使用POST,您需要手动配置UsernamePasswordAuthenticationFilter,并使用而不是来使用http.formLogin()
protected void configure(HttpSecurity http) throws Exception {
UsernamePasswordAuthenticationFilter authFilter = new UsernamePasswordAuthenticationFilter();
authFilter.setPostOnly(false);
http
// other configuration...
.addFilterAfter(authFilter, LogoutFilter.class);
}但是你必须意识到GET方法是完全不安全的--你的密码将会通过像www.yoursite.com/j_spring_security_check?j_password=some_password这样的网址的查询参数来传递。并且许多HTTP服务器将传入的URL记录在它们的日志文件中。所以你的密码最终会出现在日志中,这一点都不好。
https://stackoverflow.com/questions/30389941
复制相似问题