I can help you with that since we are deeply integrating keycloak with our wiki.
You can use
GitHub - tdudgeon/xwiki_authenticator_keycloak: Keycloak authenticator for XWiki as base for your project
It’s 5 year old but changing xwiki version and following instructions it will works.
You must download the Keycloak adapters and follow their instructions
You can found the adapters here
https://github.com/keycloak/keycloak/releases/download/12.0.4/keycloak-oidc-tomcat-adapter-12.0.4.tar.gz all theses jar should be put in the
libs forlder of your tomcat
You will have as explain in their documentation to change
context.xml of your tomcat with
<?xml version="1.0" encoding="UTF-8"?>
Also in your
WEB-INF folder you will need
keycloak.json with your configuration
Also at the end of your
web.xml you will need something like
your_role is a realm role that your user in keycloak must have to login through the keycloak adapter
xwiki.cfg will need
Then you probably have to change a bit the extension of their github to fit your needs
This file has been truncated.
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
You should probably fork it as well, upgrade pom to your xwiki version fix java issues due to the upgrade to last version of xwiki and then recompile it to be installed in your wiki.
It’s not really an easy works especially rebuild and deploy your own version of the extension but I hope this information will save you a few days of additional work.