如何配置gerrit github插件以正确适应oauth代码流
运行Gerrit v。2.12.2使用来自的Github插件 基本上,gerrit在转到Github oauth时包含了一个“state”字段,但是当Github正确地发回该字段时,gerrit抱怨应该没有这样的字段。似乎是Gerrit中一个非常简单的bug Gerrit配置:如何配置gerrit github插件以正确适应oauth代码流,oauth,gerrit,Oauth,Gerrit,运行Gerrit v。2.12.2使用来自的Github插件 基本上,gerrit在转到Github oauth时包含了一个“state”字段,但是当Github正确地发回该字段时,gerrit抱怨应该没有这样的字段。似乎是Gerrit中一个非常简单的bug Gerrit配置: [gerrit] basePath = git canonicalWebUrl = https://gerrit.mydomain.org/ [database] type
[gerrit]
basePath = git
canonicalWebUrl = https://gerrit.mydomain.org/
[database]
type = postgresql
hostname = localhost
database = reviewdb
username = gerrit2
[index]
type = LUCENE
[auth]
type = HTTP
httpHeader = GITHUB_USER
logoutUrl = /oauth/reset
httpExternalIdHeader = GITHUB_OAUTH_TOKEN
loginUrl = /login
loginText = Sign-in with GitHub
registerPageUrl = "/#/register"
[receive]
enableSignedPush = false
[sendemail]
smtpServer = localhost
[container]
user = gerrit2
javaHome = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-1.b15.fc22.x86_64/jre
[sshd]
listenAddress = *:29418
[httpd]
filterClass = com.googlesource.gerrit.plugins.github.oauth.OAuthFilter
listenUrl = proxy-http://127.0.0.1:8081/r/
[cache]
directory = cache
[github]
url = https://github.com
apiUrl = https://api.github.com
clientId = <myclientid>
页面上写着:
Server Error
日志中的错误为:
[2016-04-03 16:23:28,787] [HTTP-45] WARN org.eclipse.jetty.servlet.ServletHandler : /r/oauth
java.io.IOException: Invalid authentication state: expected 'null' but was 'Q00fnnr9D1z_maGTWeqSDgmIedk=,/r/login'
at com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.loginPhase2(OAuthProtocol.java:356)
at com.googlesource.gerrit.plugins.github.oauth.GitHubLogin.login(GitHubLogin.java:100)
at com.googlesource.gerrit.plugins.github.oauth.OAuthWebFilter.login(OAuthWebFilter.java:123)
at com.googlesource.gerrit.plugins.github.oauth.OAuthWebFilter.doFilter(OAuthWebFilter.java:89)
at com.googlesource.gerrit.plugins.github.oauth.OAuthFilter.doFilter(OAuthFilter.java:86)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
[2016-04-03 16:23:28,791] [HTTP-45] ERROR com.google.gerrit.pgm.http.jetty.HiddenErrorHandler : Error in GET /r/oauth?code=a9d9633f80f742599ea0&state=Q00fnnr9D1z_maGTWeqSDgmIedk%3D%2C%2Fr%2Flogin
java.io.IOException: Invalid authentication state: expected 'null' but was 'Q00fnnr9D1z_maGTWeqSDgmIedk=,/r/login'
at com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.loginPhase2(OAuthProtocol.java:356)
at com.googlesource.gerrit.plugins.github.oauth.GitHubLogin.login(GitHubLogin.java:100)
at com.googlesource.gerrit.plugins.github.oauth.OAuthWebFilter.login(OAuthWebFilter.java:123)
at com.googlesource.gerrit.plugins.github.oauth.OAuthWebFilter.doFilter(OAuthWebFilter.java:89)
at com.googlesource.gerrit.plugins.github.oauth.OAuthFilter.doFilter(OAuthFilter.java:86)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
有什么建议吗?好的,您的mod_代理的URL必须与gerrit在内部收到的URL相同。例如“->”,如果一侧没有“/r/”之类的内容,它会变得混乱。我想我应该试着为gerrit自己运行2.12最新版本。我会试试的。同样的事情我想下一件事就是试着解决这个问题。我不想在我的URL中使用/r/,但是对于内部服务器,代理似乎不起作用(我得到无限的重定向或URL类型),除非我有/r/。我将尝试进一步讨论这个问题,以便/r/也不在内部服务器上。
[2016-04-03 16:23:28,787] [HTTP-45] WARN org.eclipse.jetty.servlet.ServletHandler : /r/oauth
java.io.IOException: Invalid authentication state: expected 'null' but was 'Q00fnnr9D1z_maGTWeqSDgmIedk=,/r/login'
at com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.loginPhase2(OAuthProtocol.java:356)
at com.googlesource.gerrit.plugins.github.oauth.GitHubLogin.login(GitHubLogin.java:100)
at com.googlesource.gerrit.plugins.github.oauth.OAuthWebFilter.login(OAuthWebFilter.java:123)
at com.googlesource.gerrit.plugins.github.oauth.OAuthWebFilter.doFilter(OAuthWebFilter.java:89)
at com.googlesource.gerrit.plugins.github.oauth.OAuthFilter.doFilter(OAuthFilter.java:86)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
[2016-04-03 16:23:28,791] [HTTP-45] ERROR com.google.gerrit.pgm.http.jetty.HiddenErrorHandler : Error in GET /r/oauth?code=a9d9633f80f742599ea0&state=Q00fnnr9D1z_maGTWeqSDgmIedk%3D%2C%2Fr%2Flogin
java.io.IOException: Invalid authentication state: expected 'null' but was 'Q00fnnr9D1z_maGTWeqSDgmIedk=,/r/login'
at com.googlesource.gerrit.plugins.github.oauth.OAuthProtocol.loginPhase2(OAuthProtocol.java:356)
at com.googlesource.gerrit.plugins.github.oauth.GitHubLogin.login(GitHubLogin.java:100)
at com.googlesource.gerrit.plugins.github.oauth.OAuthWebFilter.login(OAuthWebFilter.java:123)
at com.googlesource.gerrit.plugins.github.oauth.OAuthWebFilter.doFilter(OAuthWebFilter.java:89)
at com.googlesource.gerrit.plugins.github.oauth.OAuthFilter.doFilter(OAuthFilter.java:86)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)