# KeyCloak

### KeyCloak as Identity Provider

To use KeyCloak as an Auth Provider, you must install and maintain an own installation of KeyCloak. A docker installation is fast achieved.

<https://www.keycloak.org/getting-started/getting-started-docker>

In KeyCloak you have to set up first a "Realm". This is a tenant within KeyCloak. Select (or create) your Realm with the top left corner menu.

In your Realm, you can then create and configure a Client. We show here the most minimal configuration to enable Sign in and Sign up with KeyCloak for OpenFlower.

### Setup a KeyCloak Client

Choose a name and id for your Client.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-f85443d04b911edad2ebe0e7db884c1ffafe514d%2FKeyCloak%20Client%20setup%201.png?alt=media" alt=""><figcaption></figcaption></figure>

Make sure the "Standard Flow" is activated, as also "Client authentication" and "Authorization". Only when checked these options, KeyCloak will issue the needed Client-Secret.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-79629a3b0e60e4793289d51b42a1b8c28d36ff74%2FKeyCloak%20Client%20setup%202.png?alt=media" alt=""><figcaption></figcaption></figure>

Configure the OpenFlower redirect URLs.

{% hint style="info" %}
For the cloud, the "Valid redirect URI" is <https://prod-us1.openflower.org>
{% endhint %}

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-f23bafa1a580177b697dc367bb2422172bda4041%2FKeyCloak%20Client%20Setup%203.png?alt=media" alt=""><figcaption></figcaption></figure>

After the setup, you can now look for the generated Client-Secret.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-803e24759f2dc49898922b910b8a483f0a07db50%2FKeyCloak%20Credencials%20Screen.png?alt=media" alt=""><figcaption><p>copy the Client Secret for the setup of KeyCloak as Auth Provioder in OpenFlower</p></figcaption></figure>

Check the Settings to make sure the right capabilities are activated...

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-9ba91cacb68c81133d480522d6e2a686c3c43512%2FKeyCloak%20Capabilities%20Screen.png?alt=media" alt=""><figcaption></figcaption></figure>

### KeyCloak as OpenFlower Auth Provider

in OpenFlower, go to Settings > OAuth Provider and select "KeyCloak" in the "Add OAuth Provider Dialogue"

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-61c632b24aa135719882bde15a5c585f38b9e1b1%2FKeyCloak%20select%20Provider.png?alt=media" alt=""><figcaption></figcaption></figure>

Now you can enter all settings for KeyCloak

{% hint style="info" %}
Instance ID is the Base URL of your KeyCloak Installation
{% endhint %}

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-5363e16f73203ae2271cbacbae0301cac315a223%2FKeyCloak%20Setup.png?alt=media" alt=""><figcaption></figcaption></figure>

You can also change settings later.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-a061b7a286f73cf0a166dcd47816c3c0115f62b1%2FKeyCloak%20Settings.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
The minimal scope to setup is "offline\_access openid".
{% endhint %}

Thats it! Now you can use KeyCloak to offer your Users to Sign in and Sign up with KeyCloak.

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-3b1dd74ca9837a52a5d48364e63ad02690504b29%2FKeyCloak%20Sign%20in.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1375341043-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fzo5R6EJIlCfRyDLbDnBv%2Fuploads%2Fgit-blob-13bb39eec89f9054b315a4b0423f295047e75f03%2FKeyCloak%20use%20Login.png?alt=media" alt=""><figcaption></figcaption></figure>
