我目前正在实现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(查询参数)中公开用户凭据可能会被各种网络嗅探工具捕获。
有没有办法用其他方法做到这一点?
答案 0 :(得分:0)