Updated docs to include deploying providers as modules
This commit is contained in:
parent
2b78a3bf4d
commit
8cf31bd3f1
1 changed files with 51 additions and 15 deletions
|
@ -87,11 +87,46 @@ public class MyEventListenerProvider implements EventListenerProvider {
|
|||
<section>
|
||||
<title>Registering provider implementations</title>
|
||||
<para>
|
||||
Keycloak loads provider implementations from the file-system. By default all JARs inside
|
||||
<literal>standalone/configuration/providers</literal> are loaded. This is simple, but requires all providers
|
||||
to share the same library. All provides also inherit all classes from the Keycloak class-loader. In the future
|
||||
we'll add support to load providers from modules, which allows better control of class isolation.
|
||||
Keycloak can load provider implementations from JBoss Modules or directly from the file-system. Using Modules
|
||||
is recommended as you can control exactly what classes are available to your provider. Any providers loaded
|
||||
from the file-system uses a classloader with the Keycloak classloader as its parent.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
<title>Register a provider using Modules</title>
|
||||
<para>
|
||||
To register a provider using Modules first create a module. To do this you have to create a folder inside
|
||||
KEYCLOAK_HOME/modules and add your jar and a <literal>module.xml</literal>. For example to add the event listener
|
||||
sysout example provider create the folder <literal>KEYCLOAK_HOME/modules/org/keycloak/examples/event-sysout/main</literal>.
|
||||
Copy <literal>event-listener-sysout-example.jar</literal> to this folder and create <literal>module.xml</literal>
|
||||
with the following content:
|
||||
<programlisting><![CDATA[{
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="urn:jboss:module:1.1" name="org.keycloak.examples.event-sysout">
|
||||
<resources>
|
||||
<resource-root path="event-listener-sysout-example.jar"/>
|
||||
</resources>
|
||||
<dependencies>
|
||||
<module name="org.keycloak.keycloak-core"/>
|
||||
<module name="org.keycloak.keycloak-model-api"/>
|
||||
<module name="org.keycloak.keycloak-events-api"/>
|
||||
</dependencies>
|
||||
</module>
|
||||
}]]></programlisting>
|
||||
Next you need to register this module with Keycloak. This is done by editing keycloak-server.json and adding
|
||||
it to the providers:
|
||||
<programlisting><![CDATA[{
|
||||
"providers": [
|
||||
...
|
||||
"module:org.keycloak.examples.event-sysout"
|
||||
]
|
||||
}]]></programlisting>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
<section>
|
||||
<title>Register a provider using file-system</title>
|
||||
<para>
|
||||
To register your provider simply copy the JAR including the ProviderFactory and Provider classes and the
|
||||
provider configuration file to <literal>standalone/configuration/providers</literal>.
|
||||
|
@ -115,6 +150,7 @@ public class MyEventListenerProvider implements EventListenerProvider {
|
|||
}]]></programlisting>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Available SPIs</title>
|
||||
|
|
Loading…
Reference in a new issue