LDAP and Google oauth2 authorization together

Dear All,

I need some help. I would like to configure XWiki to allow LDAP and Google Authentication on the login screen. I configured and tested both login options separately one by one. Both of them are working without any problem if only one is enabled in xwiki.cfg.
My problem is if I enable both auth in the configuration file than always only the last one is active. I can’t use both of them but on the login screen I have separated buttons for Google Login and Ldap login. Is it possible to use these authentication methods together somehow?

I know this:
“XWiki supports several different authentication mechanisms for authenticating users. XWiki currently allows only one method of authentication to be enabled at a time. This will probably be improved in the future.” but maybe there is any solution.

Example:

#Google auth
xwiki.authentication.authclass=com.xpn.xwiki.user.impl.xwiki.GroovyAuthServiceImpl
xwiki.authentication.groovy.pagename=xwiki:GoogleApps.AuthService

#-# LDAP authentication service
xwiki.authentication.authclass=org.xwiki.contrib.ldap.XWikiLDAPAuthServiceImpl

#-# Turn LDAP authentication on - otherwise only XWiki authentication
#-# - 0: disable
#-# - 1: enable
#-# The default is 0
xwiki.authentication.ldap=1

In this case only the LDAP authentication is working because this is the last one in cfg file…

Thanks for your help in advance!

Yes XWiki does not support several authenticators at the same time right now. So you would need write an authenticator which would dispatch to the right one behind the scene.

Thanks for your quick reply. I am not a java expert but I will try to do this. Maybe you can give me some advice about how can I start this?

Knowing a little bit of Java should be enough. The hard part is more knowing which authenticator(s) to call depending on the request/context.

To write a custom authenticator you can take a look at http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Authentication/#HCustomAuthentication.