Extend Keycloak without forking it
Keycloak covers most standard authentication needs. When your use case goes beyond that — a specific check during login, business data to put in tokens, an existing user database to plug in — Keycloak is extended through its Service Provider Interfaces (SPI): Java extension points, packaged as a JAR and deployed next to the server, without touching its source code.
We have been building these extensions for years, for our clients and as open source.