Spring OAuth2安全问题

问题描述 投票:0回答:1

我当前正在实现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服务发出POST请求-http://oauth/perform_login?username=USERNAME&password=PASSWORD

我在Postman上尝试过,并且可以正常工作。但是,在查询参数中像上面一样发送纯用户名和密码不是安全问题吗?我认为在uri(查询参数)中公开用户凭据可能会被各种网络嗅探工具捕获。

有没有办法用其他方法做到这一点?

spring spring-security-oauth2
1个回答
0
投票
  1. 只要您使用HTTPS,您的查询参数将是安全的。
  2. [不清楚,为什么您的SSO网站应该对该URL进行POST(以及为什么不具有POST正文,而是通过url附加参数)。它不应该“重定向”到登录页面/授权服务器,还是上面的代码来自您的授权服务器?您的描述不清楚。
© www.soinside.com 2019 - 2024. All rights reserved.