2016-04-03 4 views
0

Github v2.12.2をGithubプラグインで実行しています(https://gerrit-ci.gerritforge.com/job/plugin-github-mvn-stable-2.12/)。oauthコードフローに正しく対応するようにgerrit githubプラグインを設定する方法

GithubはGithub oauthに行くと基本的に "state"フィールドを含んでいますが、Githubが正しくフィールドを返すと、Gerritはそのようなフィールドがないはずだと不平を言います。 Gerritには非常に単純なバグのようです。 Apacheのmod_proxyを下ヘリットを実行

[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> 

ヘリットの設定。

https://gerrit.mydomain.org/oauth?code=a9d9633f80f742599ea0&state=Q00fnnr9D1z_maGTWeqSDgmIedk%3D%2C%2Fr%2Flogin 

ページは言う:「のGithubでログインします」ボタンをクリックして、Githubににリダイレクトし、ログインし、アプリを承認、これはコールバックURLでログに

Server Error 

エラーis:

[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) 

+0

gerrit自体に2.12 LATESTを実行するようにしてください。それを試みます。 – zzzeek

+0

mmmm nope。同じこと – zzzeek

+0

私は次のことは/ r /事を解決しようとしていると思います。私は/ r /を私のURLに入れたくありませんが、内部サーバーの場合、プロキシは動作しないようです(私は無制限のリダイレクトやhttps:// myserver ////////// URLの種類を取得します私が/ r /を持っていなければ。/r /が内部サーバーにもないように、もう少し詳しく調べてみます。 – zzzeek

答えて

0

OK、mod_proxyのURLは、gerritが内部で受信しているURLと同じである必要があります。例えば。 "https://example.com/" - > "http://localhost:8081/"、片側に "/ r /"のようなものがないと混乱します。

関連する問題