Updated docs to include deploying providers as modules

This commit is contained in:
Stian Thorgersen 2015-03-06 07:13:15 +01:00
parent 2b78a3bf4d
commit 8cf31bd3f1

View file

@ -87,11 +87,46 @@ public class MyEventListenerProvider implements EventListenerProvider {
<section> <section>
<title>Registering provider implementations</title> <title>Registering provider implementations</title>
<para> <para>
Keycloak loads provider implementations from the file-system. By default all JARs inside Keycloak can load provider implementations from JBoss Modules or directly from the file-system. Using Modules
<literal>standalone/configuration/providers</literal> are loaded. This is simple, but requires all providers is recommended as you can control exactly what classes are available to your provider. Any providers loaded
to share the same library. All provides also inherit all classes from the Keycloak class-loader. In the future from the file-system uses a classloader with the Keycloak classloader as its parent.
we'll add support to load providers from modules, which allows better control of class isolation.
</para> </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> <para>
To register your provider simply copy the JAR including the ProviderFactory and Provider classes and the 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>. provider configuration file to <literal>standalone/configuration/providers</literal>.
@ -115,6 +150,7 @@ public class MyEventListenerProvider implements EventListenerProvider {
}]]></programlisting> }]]></programlisting>
</para> </para>
</section> </section>
</section>
<section> <section>
<title>Available SPIs</title> <title>Available SPIs</title>