当前位置: 首页 > 知识库问答 >
问题:

Spring security oauth2客户端-重定向太多

党航
2023-03-14

这是我的应用程序属性文件:

spring.security.oauth2.client.registration.myclient.client-id=SampleClientId
spring.security.oauth2.client.registration.myclient.client-secret=secret
spring.security.oauth2.client.provider.myclient.authorization-uri=http://localhost:8081/auth/oauth/authorize
spring.security.oauth2.client.provider.myclient.token-uri=http://localhost:8081/auth/oauth/token
spring.security.oauth2.client.provider.myclient.user-info-uri=http://localhost:8081/auth/user/me
spring.security.oauth2.client.registration.myclient.authorization-grant-type=authorization_code
spring.security.oauth2.client.registration.myclient.redirect-uri=http://localhost:8080/hellouser
spring.security.oauth2.client.provider.myclient.userNameAttribute=user

这是我的配置类:

@Configuration class SecurityConfig extends WebSecurityConfigurerAdapter {

  @throws[Exception]
  override protected def configure(http: HttpSecurity): Unit = {
    http.authorizeRequests.anyRequest.authenticated.and.oauth2Login
      .redirectionEndpoint()
      .baseUri("/")
  }
}
case class Message(val string: String)

@Controller
class SuccessController {

  @GetMapping(path = Array("/hellouser"), produces = Array(MediaType.APPLICATION_JSON_VALUE))
  def getHelloUser(model: Model, authentication: OAuth2AuthenticationToken ): Message = {
    Message("hello user")
  }
}

我做错了什么?

谢谢。

共有1个答案

毋胜涝
2023-03-14
    null

条件说明是,Spring Security保存了步骤1的初始请求,当授权代码流在步骤4完成时,Spring将自动重放保存的请求。

 类似资料:
  • 我的Spring Boot应用程序在同一台服务器上广播了一个RTMP流。 例如,它可以使用 rtmp://localhost/livestream 这是一个视频直播流,从RED5服务器播放。我想将这个直播流重定向到任何试图请求它的客户端。 例如: 这种行为是必要的,这样我就可以控制何时可以访问RTMP流,因为它将是实时的24小时,但只能在其中一些中访问。我将把这个逻辑放在我的上。 如何设置Spri

  • Summary This section describes how to check for Client Side URL Redirection, also known as Open Redirection. It is an input validation flaw that exists when an application accepts an user controlled i

  • 当使用Keycloak-js(版本:4.0.0)在Angular4中创建会话时,SSO不起作用 null 响应URL: http://localhost:3000/login/generic_oauth#state=wwxu1iywxtsevsxwcfzwhpz7opm63dbu5aombtmdjhe%3d&session_state=6ec8255b-ed4c-4399-951c-0241ce7

  • 我正在使用Thymeleaf开发一个简单的登录表单 我试图通过将以下属性放入我的应用程序来禁用默认的安全登录屏幕。属性: 并将以下配置添加到我的SecurityConfig中,以便除"/登录"和"/资源"之外的任何URL都将获得身份验证: 我的LoginController是明确的: 有人知道为什么会这样吗?

  • 我试图在react中实现OpenId和oidc客户端js。现在我一直在实现注销功能。 据我所知,我需要设置post\u logout\u redirect\u uri,并使用signoutRedirect()注销用户。注销用户可以正常工作,但遗憾的是,它停留在identity server注销页面。我需要做的是将用户重定向到post\u logout\u redirect\u uri。 有人能告诉

  • 前端:localhost:3000(反应应用程序)加载pp.js(客户端)调用api/ 后端:localhost:8082(nodejs express应用程序)发送重定向到客户端上的/测试endpoint 主要问题在于客户端(react),一旦API调用完成,重定向将被阻止。。。如何使客户端应用程序响应此重定向到'http://localhost:3000/test'我的后端已经有cors,启用