Understanding service provider interfaces
If you are already familiar with the Java language, you probably know what an SPI is. If not, think about it as a pluggable mechanism to add or change behavior to an extensible Java application without changing its code base.
Keycloak is built with extensibility in mind, where features are implemented using a set of well-defined interfaces. Features such as the ability to authenticate users using different authentication mechanisms, auditing, integration with legacy systems to fetch identity data, mapping claims into tokens, registering new users and updating their profiles, and integrating with third-party identity providers are all backed by a set of service interfaces and a corresponding SPI. The same is also true for core features, such as caching, storage, or the different security protocols supported by Keycloak, although for those, you would hardly have a need to customize:
Figure 13.1: Keycloak Service Provider Interface...