You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "HWENK (via GitHub)" <gi...@apache.org> on 2023/12/04 02:18:11 UTC

[I] [Bug] [oauth2] 第一次失败,失败的链接再次请求又成功。修改源码:移除AppConfiguration中的CookieLocaleResolver后不再报错。 [dolphinscheduler]

HWENK opened a new issue, #15269:
URL: https://github.com/apache/dolphinscheduler/issues/15269

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What happened
   
   使用oauth2对接内部用户中心,认证后,GET请求:http://127.0.0.1:12345/dolphinscheduler/redirect/login/oauth2?provider=xxxx&code=xxxxxxx第一次请求CookieLocaleResolver报空指针,同样的code,再次请求则成功登录进入dolphinscheduler首页。对比过两次请求的头信息,完全一样。使用edge和chrome都是会出现同样的问题。
   
   尝试修复:当修改 dolphinscheduler-api工程,AppConfiguration源码,屏蔽CookieLocaleResolver的创建,则每次登录都可以直接成功。
   
   报错详细信息如下:
   java.lang.NullPointerException: null
           at org.springframework.web.servlet.i18n.CookieLocaleResolver.parseLocaleCookieIfNecessary(CookieLocaleResolver.java:226)
           at org.springframework.web.servlet.i18n.CookieLocaleResolver.resolveLocaleContext(CookieLocaleResolver.java:198)
           at org.springframework.web.servlet.DispatcherServlet.buildLocaleContext(DispatcherServlet.java:1181)
           at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:995)
           at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:497)
           at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)
           at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
           at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656)
           at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102)
           at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
           at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
           at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
           at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
           at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
           at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
           at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102)
           at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
           at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
           at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102)
           at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
           at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
           at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
           at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
           at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:618)
           at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
           at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
           at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
           at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
           at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
           at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
           at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
           at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
           at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
           at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
           at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
           at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:229)
           at org.eclipse.jetty.server.Dispatcher.error(Dispatcher.java:86)
           at org.eclipse.jetty.server.handler.ErrorHandler.doError(ErrorHandler.java:119)
           at org.eclipse.jetty.server.handler.ErrorHandler.handle(ErrorHandler.java:95)
           at org.springframework.boot.web.embedded.jetty.JettyEmbeddedErrorHandler.handle(JettyEmbeddedErrorHandler.java:57)
           at org.eclipse.jetty.server.HttpChannel.lambda$handle$3(HttpChannel.java:536)
           at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
           at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:534)
           at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
           at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
           at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
           at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
           at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
           at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
           at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
           at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
           at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
   
   
   ### What you expected to happen
   
   GET请求:http://127.0.0.1:12345/dolphinscheduler/redirect/login/oauth2?provider=xxxx&code=xxxxxxx
   应该第一次就跳转成功。
   
   ### How to reproduce
   
   使用oauth2对接登录认证(对接内部认证系统,对接gitee或者github未尝试是否有问题)
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   3.2.x
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [oauth2] The first time failed, the failed link was successfully requested again. Modify the source code: No error will be reported after removing CookieLocaleResolver in AppConfiguration. [dolphinscheduler]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #15269:
URL: https://github.com/apache/dolphinscheduler/issues/15269#issuecomment-1837733469

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What happened
   
   Use oauth2 to connect to the internal user center. After authentication, GET request: http://127.0.0.1:12345/dolphinscheduler/redirect/login/oauth2?provider=xxxx&code=xxxxxxx. The first time the CookieLocaleResolver is requested, a null pointer is reported. The same code is used again. The request successfully logs in to the dolphinscheduler homepage. After comparing the header information of the two requests, they are exactly the same. The same problem will occur when using edge and chrome.
   
   Try to fix: When modifying the dolphinscheduler-api project and AppConfiguration source code to block the creation of CookieLocaleResolver, each login can be successful directly.
   
   The error details are as follows:
   java.lang.NullPointerException: null
           at org.springframework.web.servlet.i18n.CookieLocaleResolver.parseLocaleCookieIfNecessary(CookieLocaleResolver.java:226)
           at org.springframework.web.servlet.i18n.CookieLocaleResolver.resolveLocaleContext(CookieLocaleResolver.java:198)
           at org.springframework.web.servlet.DispatcherServlet.buildLocaleContext(DispatcherServlet.java:1181)
           at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:995)
           at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:497)
           at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)
           at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
           at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656)
           at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102)
           at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
           at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
           at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
           at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
           at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
           at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
           at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102)
           at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
           at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
           at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:102)
           at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
           at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
           at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
           at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
           at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:618)
           at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
           at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
           at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
           at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
           at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
           at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
           at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
           at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
           at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
           at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
           at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
           at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:229)
           at org.eclipse.jetty.server.Dispatcher.error(Dispatcher.java:86)
           at org.eclipse.jetty.server.handler.ErrorHandler.doError(ErrorHandler.java:119)
           at org.eclipse.jetty.server.handler.ErrorHandler.handle(ErrorHandler.java:95)
           at org.springframework.boot.web.embedded.jetty.JettyEmbeddedErrorHandler.handle(JettyEmbeddedErrorHandler.java:57)
           at org.eclipse.jetty.server.HttpChannel.lambda$handle$3(HttpChannel.java:536)
           at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
           at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:534)
           at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
           at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
           at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
           at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
           at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
           at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
           at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
           at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
           at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
   
   
   ### What you expected to happen
   
   GET request: http://127.0.0.1:12345/dolphinscheduler/redirect/login/oauth2?provider=xxxx&code=xxxxxxx
   It should jump successfully the first time.
   
   ### How to reproduce
   
   Use oauth2 to connect to login authentication (connect to the internal authentication system, try to connect to gitee or github if there is any problem)
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   3.2.x
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [oauth2] The first time failed, the failed link was successfully requested again. Modify the source code: No error will be reported after removing CookieLocaleResolver in AppConfiguration. [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on issue #15269:
URL: https://github.com/apache/dolphinscheduler/issues/15269#issuecomment-1842013420

   Please using english to describe. @HWENK 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [oauth2] The first time failed, the failed link was successfully requested again. Modify the source code: No error will be reported after removing CookieLocaleResolver in AppConfiguration. [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS closed issue #15269: [Bug] [oauth2] The first time failed, the failed link was successfully requested again. Modify the source code: No error will be reported after removing CookieLocaleResolver in AppConfiguration.
URL: https://github.com/apache/dolphinscheduler/issues/15269


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] [oauth2] The first time failed, the failed link was successfully requested again. Modify the source code: No error will be reported after removing CookieLocaleResolver in AppConfiguration. [dolphinscheduler]

Posted by "opop32165455 (via GitHub)" <gi...@apache.org>.
opop32165455 commented on issue #15269:
URL: https://github.com/apache/dolphinscheduler/issues/15269#issuecomment-1918817674

   我按  (Issue [#15284](https://github.com/apache/dolphinscheduler/issues/15284))  楼上老哥说的removing CookieLocaleResolver in AppConfiguration(注释掉这个Bean) 解决了这个问题。有个要注意的点redirectUri: http://macbook:12345/dolphinscheduler/redirect/login/oauth2 是这个 没有/ui/ 因为是调后端接口 然后再执行重定向


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org