【发布时间】:2020-07-02 04:35:52
【问题描述】:
我目前正在实施 Authorization_Code 类型的 OAuth2 流程,以便在我的网站上进行单点登录 (SSO)。
这是我启用它的代码。
@Override
protected void configure(final HttpSecurity http) throws Exception {
// @formatter:off
http.authorizeRequests()
.antMatchers("/login", "/authorize", "/error")
.permitAll()
.anyRequest()
.authenticated()
.and().formLogin().loginPage("https://sso.mywebsite.com").loginProcessingUrl("/perform_login")
.defaultSuccessUrl("/success",true)
.failureUrl("/error").permitAll()
.and()
.csrf()
.disable();
// @formatter:on
}
我的担忧如下所述。
要发出登录请求(使用用户名和密码),sso.mywebsite.com 应该向我的 oAuth 服务 - http://oauth/perform_login?username=USERNAME&password=PASSWORD 发出 POST 请求。
我用 Postman 试了一下,效果很好。但是,在查询参数中发送像上面这样的普通用户名和密码不是一个安全问题吗?我认为在 uri(查询参数)中暴露用户凭据可能会被各种网络嗅探工具捕获。
有没有办法用不同的方法做到这一点?
【问题讨论】:
标签: spring spring-security-oauth2