首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring安全登录:查看源码可以看到密码

Spring安全登录:查看源码可以看到密码
EN

Stack Overflow用户
提问于 2015-05-22 14:40:34
回答 1查看 201关注 0票数 1

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

任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2015-05-22 18:06:15

要使用POST,您需要手动配置UsernamePasswordAuthenticationFilter,并使用而不是来使用http.formLogin()

代码语言:javascript
复制
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记录在它们的日志文件中。所以你的密码最终会出现在日志中,这一点都不好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30389941

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档