Spring boot SpringBoot 2存在oAuth重定向问题

Spring boot SpringBoot 2存在oAuth重定向问题,spring-boot,spring-oauth2,Spring Boot,Spring Oauth2,我正在尝试通过公司内部的身份验证服务器进行身份验证和身份验证 使用ERR_TOO_MANY_重定向和HTTP 302获取以下错误 2019-09-18 09:23:54.310 TRACE 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection : KeepAlive stream retrieved from the cache, sun.net.www.protocol.https.HttpsClient(https:

我正在尝试通过公司内部的身份验证服务器进行身份验证和身份验证

使用ERR_TOO_MANY_重定向和HTTP 302获取以下错误

2019-09-18 09:23:54.310 TRACE 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection  : KeepAlive stream retrieved from the cache, sun.net.www.protocol.https.HttpsClient(https://privateURL/tokeninfo)
2019-09-18 09:23:54.310 TRACE 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection  : Proxy used: DIRECT
2019-09-18 09:23:54.310 DEBUG 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection  : sun.net.www.MessageHeader@3b6fad4e6 pairs: {GET /oauth2/tokeninfo HTTP/1.1: null}{Authorization: Bearer eyJraWQiOi####}{Accept: application/json, application/*+json}{User-Agent: Java/11.0.4}{Host: privateURL.com}{Connection: keep-alive}
2019-09-18 09:23:54.315 DEBUG 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection  : sun.net.www.MessageHeader@56d0f8f314 pairs: {null: HTTP/1.1 401 Unauthorized}{Date: Wed, 18 Sep 2019 09:23:54 GMT}{Content-Type: application/problem+json}{Transfer-Encoding: chunked}{Connection: keep-alive}{Cache-Control: no-cache, no-store, max-age=0, must-revalidate}{Expires: 0}{Pragma: no-cache}{Server: unspecified}{Strict-Transport-Security: max-age=31536000 ; includeSubDomains}{X-Content-Type-Options: nosniff}{X-Flow-Id: RiNj7zF0fq3MWJBePUzlkA}{X-Frame-Options: DENY}{X-Xss-Protection: 1; mode=block}
2019-09-18 09:23:54.316 DEBUG 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection  : Server Authentication for AuthenticationHeader: prefer null returned null
2019-09-18 09:23:54.316 DEBUG 8 --- [qtp254692047-20] org.springframework.web.HttpLogging      : Response 401 UNAUTHORIZED
2019-09-18 09:23:54.317 DEBUG 8 --- [qtp254692047-20] o.s.w.c.HttpMessageConverterExtractor    : Reading to [org.springframework.security.oauth2.common.exceptions.OAuth2Exception]
2019-09-18 09:23:54.318  WARN 8 --- [qtp254692047-20] o.s.b.a.s.o.r.UserInfoTokenServices      : Could not fetch user details: class org.springframework.web.client.HttpClientErrorException$Unauthorized, 401 Unauthorized
2019-09-18 09:23:54.318 DEBUG 8 --- [qtp254692047-20] o.s.b.a.s.o.r.UserInfoTokenServices      : userinfo returned error: Could not fetch user details
...
2019-09-18 09:23:54.229 DEBUG 8 --- [qtp254692047-18] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=2019-09-18T09:23:54.229553Z, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@0: RemoteIpAddress: 99.99.99.99; SessionId: xxx, type=org.springframework.security.access.AccessDeniedException, message=Access is denied}]
...
ttp_server_requests_seconds{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",quantile="0.5",} 0.011534336
http_server_requests_seconds{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",quantile="0.75",} 0.014680064
http_server_requests_seconds{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",quantile="0.95",} 0.047710208
http_server_requests_seconds{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",quantile="0.99",} 0.536346624
http_server_requests_seconds_count{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",} 14.0
http_server_requests_seconds_sum{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",} 0.719216709```

Any pointers on what could be the problem here ? 


ERR\u-TOO\u-MANY\u重定向
当浏览器收到重定向请求时,会发生错误,开始该请求,并因此向浏览器发送另一个重定向请求(通常是完全相同的重定向请求)

简单地说,浏览器陷入无限重定向循环


最有可能的是,在您点击安全端点后,重定向到另一个安全端点,而不是允许用户进行自我验证的不安全端点,然后循环关闭

我认为这是自我解释的
ERR\u TOO\u MANY\u重定向
ERR\u TOO\u MANY\u重定向是症状,原因可能是什么?写在我的答案中。@AbhishekAsh不安全端点在上面的上下文中类似于登录页面,不需要用户已经过身份验证。