gerrit-oauth-provider: Plugin does not work in master branch with oauth.type=OAUTH

It appears that choosing this auth type means that Gerrit now expects a plugin to include an OAuthLoginProvider to be used for logging in. Since gerrit-oauth-provider does not include this, the plugin no longer works.

I was still able to get the plugin to work by using the OPENID_SSO auth type, but the plugin docs say not to do that so I’m concerned that it is not a good workaround.

edit: looking into it more, I guess the issue is that on the master branch of gerrit the logic in GitOverHttpModule.java is different: it sets authFilter = ProjectOAuthFilter.class whenever the auth type is OAUTH, whereas in the release branch it requires basic auth to be enabled as well. This was done in commit 84d830b5b350fdbae7c075473bceea9ec619b3c9

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Ah right, the configuration is invalid. We should document it more prominently.

See this change and particularly the default: [1] auth.gitBasicAuthPolicy is configured as:

By default this is set to `LDAP` when link:#auth.type[`auth.type`] is `LDAP`
and `OAUTH` when link:#auth.type[`auth.type`] is `OAUTH`.
Otherwise, the default value is `HTTP`.

So, that in case of auth.type == OAUTH, auth.gitBasicAuthPolicy is initialized to OAUTH. However the gerrit-provider-plugin currently doesn’t implement that policy, so that it cannot work.

Solution: overload that policy with HTTP:

[auth]
        type = OAUTH
        gitBasicAuthPolicy = HTTP

and this should fix it.

[1] https://gerrit-review.googlesource.com/#/c/gerrit/+/99079/5/Documentation/config-gerrit.txt@495

We should document it more prominently.

I added documentation to https://github.com/davido/gerrit-oauth-provider/wiki/FAQ.