On Tue, Sep 18, 2012 at 6:04 PM, Andreas Borglin
<
andreas...@neonstingray.com> wrote:
> We're now looking at setting Gerrit up for our team.
> I can see that 2.5 rc0 has been released with support for that plugin system
> you referred to here.
>
> I spent some more time investigating this, and noticed that Jenkins supports
> something they call "Google Apps SSO", which allows you to restrict OpenId
> logins to a specific Google Apps domain.
> They have implemented this with open4java, which from what I can tell, is
> the same lib that Gerrit is using to support OpenId. From looking at the
> code, it seems to be fairly minor modifications to the how you handle
> standard OpenId auth.
> (
https://github.com/jenkinsci/openid-plugin/blob/master/src/main/java/hudson/plugins/openid/GoogleAppSsoSecurityRealm.java)
>
> Now, I've been trying to figure out how I would go about writing a plugin to
> extend / replace the current OpenId authentication method in Gerrit, but not
> quite sure how I'd get started with that.
> Is this something that should be committed to the Gerrit core, or is there a
> way to do this via a plugin? Any pointers would be great in that case.
> Seems like Gerrit would need to support one additional auth.type -
> OpenID_GoogleApps and an additional parameter auth.allowedGoogleAppsDomain.
It isn't currently possible to write a plugin to handle an
authentication system. The authentication system code is strewn
throughout the code base. auth.type converts to an enum, AuthType, and
there are many switches that do different things throughout the code
based on the value of AuthType. :-(
If it is just a minor modification to the openid4java usage, it might
be fairly simple to support this with auth.type = OpenID and a new
auth parameter that specifies the Google Apps domain to limit login
to. This may be a fairly small change to the OpenID code, and would be
easier to do than replacing the entire authentication system to
support plugins first.
Of course we really should support plugins for authentication systems
just like we do for group systems, but its a non-trivial effort that
will take some significant time to code.