2014-01-13 01:57:31 +00:00
|
|
|
<section id="adapter-config">
|
|
|
|
<title>General Adapter Config</title>
|
|
|
|
<para>
|
|
|
|
Each adapter supported by Keycloak can be configured by a simple JSON text file. This is what one might
|
|
|
|
look like:
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<programlisting><![CDATA[{
|
|
|
|
"realm" : "demo",
|
|
|
|
"resource" : "customer-portal",
|
|
|
|
"realm-public-key" : "MIGfMA0GCSqGSIb3D...31LwIDAQAB",
|
2014-01-15 21:57:12 +00:00
|
|
|
"auth-server-url" : "https://localhost:8443/auth",
|
2014-08-01 10:20:23 +00:00
|
|
|
"ssl-required" : "external",
|
2014-09-08 08:24:47 +00:00
|
|
|
"use-resource-role-mappings" : false,
|
2014-01-13 01:57:31 +00:00
|
|
|
"enable-cors" : true,
|
|
|
|
"cors-max-age" : 1000,
|
|
|
|
"cors-allowed-methods" : [ "POST", "PUT", "DELETE", "GET" ],
|
|
|
|
"bearer-only" : false,
|
|
|
|
"expose-token" : true,
|
|
|
|
"credentials" : {
|
2014-02-25 21:23:29 +00:00
|
|
|
"secret" : "234234-234234-234234"
|
2014-10-07 09:21:15 +00:00
|
|
|
},
|
2014-01-13 01:57:31 +00:00
|
|
|
|
2014-01-15 21:57:12 +00:00
|
|
|
"connection-pool-size" : 20,
|
2014-10-07 09:21:15 +00:00
|
|
|
"disable-trust-manager": false,
|
2014-01-15 21:57:12 +00:00
|
|
|
"allow-any-hostname" : false,
|
2014-01-13 01:57:31 +00:00
|
|
|
"truststore" : "path/to/truststore.jks",
|
|
|
|
"truststore-password" : "geheim",
|
|
|
|
"client-keystore" : "path/to/client-keystore.jks",
|
|
|
|
"client-keystore-password" : "geheim",
|
|
|
|
"client-key-password" : "geheim"
|
|
|
|
}]]>
|
|
|
|
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Some of these configuration switches may be adapter specific and some are common across all adapters.
|
|
|
|
For Java adapters you can use <literal>${...}</literal> enclosure as System property replacement.
|
|
|
|
For example <literal>${jboss.server.config.dir}</literal>. Also, you can obtain a template
|
|
|
|
for this config file from the admin console. Go to the realm and application you want a template for.
|
|
|
|
Go to the <literal>Installation</literal> tab and this will provide you with a template that includes
|
|
|
|
the public key of the realm.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Here is a description of each item:
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>realm</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Name of the realm representing the users of your distributed applications and services.
|
|
|
|
This is
|
|
|
|
<emphasis>REQUIRED.</emphasis>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>resource</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Username of the application. Each application has a username that is used when the
|
|
|
|
application connects with the Keycloak server to turn an access code into an access token
|
|
|
|
(part of the OAuth 2.0 protocol). This is
|
|
|
|
<emphasis>REQUIRED.</emphasis>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>realm-public-key</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
PEM format of public key. You can obtain this from the administration console.
|
|
|
|
This is
|
|
|
|
<emphasis>REQUIRED.</emphasis>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2014-01-15 21:57:12 +00:00
|
|
|
<term>auth-server-url</term>
|
2014-01-13 01:57:31 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2014-01-15 21:57:12 +00:00
|
|
|
The base URL of the Keycloak Server. All other Keycloak pages and REST services are derived
|
|
|
|
from this. It is usually of the form <literal>https://host:port/auth</literal>
|
2014-01-13 01:57:31 +00:00
|
|
|
This is
|
|
|
|
<emphasis>REQUIRED.</emphasis>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2014-08-01 10:20:23 +00:00
|
|
|
<term>ssl-required</term>
|
2014-01-13 01:57:31 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Ensures that all communication to and from the Keycloak server from the adapter is over HTTPS.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>. The default value is
|
2014-08-01 10:20:23 +00:00
|
|
|
<emphasis>external</emphasis>
|
|
|
|
meaning that HTTPS is required by default for external requests. Valid values are 'all', 'external'
|
|
|
|
and 'none'.
|
2014-01-13 01:57:31 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2014-09-08 08:24:47 +00:00
|
|
|
<term>use-resource-role-mappings</term>
|
2014-01-13 01:57:31 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If set to true, the adapter will look inside the token for application level role mappings for
|
|
|
|
the
|
|
|
|
user. If false, it will look at the realm level for user role mappings.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>. The default value is <emphasis>false</emphasis>.
|
2014-01-13 01:57:31 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>enable-cors</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
This enables CORS support. It will handle CORS preflight requests. It will also look into
|
|
|
|
the access token to determine valid origins.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>. The default value is <emphasis>false</emphasis>.
|
2014-01-13 01:57:31 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>cors-max-age</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If CORS is enabled, this sets the value of the
|
|
|
|
<literal>Access-Control-Max-Age</literal>
|
|
|
|
header.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>. If not set, this header is not returned in CORS
|
2014-01-13 01:57:31 +00:00
|
|
|
responses.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>cors-allowed-methods</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If CORS is enabled, this sets the value of the
|
|
|
|
<literal>Access-Control-Allow-Methods</literal>
|
|
|
|
header. This should be a JSON list of strings.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>. If not set, this header is not returned in CORS
|
2014-01-13 01:57:31 +00:00
|
|
|
responses.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>bearer-only</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2014-02-18 10:36:58 +00:00
|
|
|
This tells the adapter to only do bearer token authentication. That is, it will not do
|
2014-01-13 01:57:31 +00:00
|
|
|
OAuth 2.0 redirects, but only accept bearer tokens through the
|
|
|
|
<literal>Authorization</literal>
|
|
|
|
header.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>. The default value is <emphasis>false</emphasis>.
|
2014-01-13 01:57:31 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>expose-token</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2014-02-18 10:36:58 +00:00
|
|
|
If <literal>true</literal>, an authenticated browser client (via a Javascript HTTP invocation)
|
|
|
|
can obtain the signed access token via the URL <literal>root/k_query_bearer_token</literal>.
|
|
|
|
This is <emphasis>OPTIONAL</emphasis>. The default value is <emphasis>false</emphasis>.
|
2014-01-13 01:57:31 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>credentials</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Specify the credentials of the application. This is an object notation where the key
|
|
|
|
is the credential type and the value if the value of the credential type. Currently only
|
|
|
|
<literal>password</literal>
|
|
|
|
is supported.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>REQUIRED</emphasis>.
|
2014-01-13 01:57:31 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2014-01-15 21:57:12 +00:00
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>connection-pool-size</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Adapters will make separate HTTP invocations to the Keycloak Server to turn an access code
|
|
|
|
into an access token. This config option defines how many connections to the Keycloak Server
|
|
|
|
should be pooled.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>. The default value is <literal>20</literal>.
|
2014-01-15 21:57:12 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>disable-trust-manager</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If the Keycloak Server requires HTTPS and this config option is set to <literal>true</literal>
|
|
|
|
you do not have to specify a truststore. While convenient, this setting is not recommended
|
|
|
|
as you will not be verifying the host name of the Keycloak Server.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>. The default value is <literal>false</literal>.
|
2014-01-15 21:57:12 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>allow-any-hostname</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If the Keycloak Server requires HTTPS and this config option is set to <literal>true</literal>
|
|
|
|
the Keycloak Server's certificate is validated via the truststore, but host name validation is
|
|
|
|
not done. This is not a recommended. This seting may be useful in test environments
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>. The default value is <literal>false</literal>.
|
2014-01-15 21:57:12 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2014-01-13 01:57:31 +00:00
|
|
|
<varlistentry>
|
|
|
|
<term>truststore</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
This setting is for Java adapters. This is the file path to a Java keystore file.
|
|
|
|
Used for outgoing HTTPS communications to the Keycloak server. Client making HTTPS
|
2014-02-18 10:36:58 +00:00
|
|
|
requests need a way to verify the host of the server they are talking to. This is
|
2014-01-13 01:57:31 +00:00
|
|
|
what the trustore does. The keystore contains one or more trusted
|
|
|
|
host certificates or certificate authorities. You can
|
|
|
|
create this truststore by extracting the public certificate of the Keycloak server's SSL
|
|
|
|
keystore.
|
|
|
|
This is
|
|
|
|
<emphasis>OPTIONAL</emphasis>
|
|
|
|
if
|
2014-08-01 10:20:23 +00:00
|
|
|
<literal>ssl-required</literal>
|
2014-01-13 01:57:31 +00:00
|
|
|
is
|
2014-08-01 10:20:23 +00:00
|
|
|
<literal>none</literal>
|
2014-01-13 01:57:31 +00:00
|
|
|
or
|
|
|
|
<literal>disable-trust-manager</literal>
|
2014-02-18 10:36:58 +00:00
|
|
|
is <literal>true</literal>. The default value is<emphasis>false</emphasis>.
|
2014-01-13 01:57:31 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>truststore-password</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Password for the truststore keystore.
|
|
|
|
This is
|
|
|
|
<emphasis>REQUIRED</emphasis>
|
|
|
|
if
|
|
|
|
<literal>truststore</literal>
|
|
|
|
is set.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>client-keystore</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
<emphasis>Not supported yet, but we will support in future versions.</emphasis>
|
|
|
|
|
|
|
|
This setting is for Java adapters. This is the file path to a Java keystore file.
|
|
|
|
This keystore contains client certificate for two-way SSL when the adapter makes
|
|
|
|
HTTPS requests to the Keycloak server.
|
2014-02-18 10:36:58 +00:00
|
|
|
This is <emphasis>OPTIONAL</emphasis>.
|
2014-01-13 01:57:31 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>client-keystore-password</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
<emphasis>Not supported yet, but we will support in future versions.</emphasis>
|
|
|
|
Password for the client keystore.
|
|
|
|
This is
|
|
|
|
<emphasis>REQUIRED</emphasis>
|
|
|
|
if
|
|
|
|
<literal>client-keystore</literal>
|
|
|
|
is set.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term>client-key-password</term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
<emphasis>Not supported yet, but we will support in future versions.</emphasis>
|
|
|
|
Password for the client's key.
|
|
|
|
This is
|
|
|
|
<emphasis>REQUIRED</emphasis>
|
|
|
|
if
|
|
|
|
<literal>client-keystore</literal>
|
|
|
|
is set.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
2014-02-18 10:36:58 +00:00
|
|
|
</section>
|