Skip to content

Commit 7b666b8

Browse files
authored
Add Keycloak guide (#28)
* docs: create auth/keycloak * docs: update auth/keycloak
1 parent a4010b8 commit 7b666b8

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

auth.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Most strategies require some configuration. Check out the links below for module
2727
- Firebase
2828
- [GitHub](/auth/github)
2929
- [Google](/auth/google)
30+
- [Keycloak OpenID Connect](/auth/keycloak)
3031
- [LDAP / Active Directory](/auth/ldap)
3132
- [Local](/auth/local)
3233
- Microsoft

auth/keycloak.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Keycloak
3+
description: Authentication Module
4+
published: true
5+
date: 2021-09-15T07:49:57.150Z
6+
tags: auth, module
7+
---
8+
9+
# Keycloak
10+
[Keycloak](https://keycloak.org) is an Open Source Identity and Access Management solution for modern Applications and Services.
11+
12+
## Relevant information
13+
- [Keycloak OIDC Endpoints](https://www.keycloak.org/docs/latest/server_admin/#keycloak-server-oidc-uri-endpoints)
14+
- [Keycloak OIDC Clients](https://www.keycloak.org/docs/latest/server_admin/#_clients)
15+
16+
## Setup
17+
### Create Keycloak strategy instance on Wiki.js
18+
1. In the Administration area of your wiki, click on `Authentication` in the left navigation menu
19+
2. Click on `+ ADD STRATEGY`, scroll down and select `Keycloak`
20+
3. Go to the bottom of the page and copy/note the `Callback URL / Redirect URI`
21+
4. Keep this page/tab open. We will fill out the rest after setting up the Keycloak client
22+
23+
### Creating a Keycloak client
24+
1. At the Keycloak administration page, go to the `Clients` menu, and click `Create` button on the right
25+
2. Enter a **Client ID**, for example `wikijs` (You wil need the `Client ID` later)
26+
3. Select **openid-connect** as `Client Protocol`
27+
4. And **Root URL** is the base URL to Wikijs (for example `https://wiki.example.com`)
28+
5. Click **Save**
29+
6. Change **Access Type** to `confidential`
30+
7. Enter the **Valid Redirect URIs**, which is the `Callback URL / Redirect URI` from Wiki.js (ex. `https://wiki.example.com/login/d03f689b-0dd0-44d6-90ca-6386ec41d799/callback`, or just the path `/login/{GUID}/callback`)
31+
8. Set **Base URL** to the same as `Root URL`
32+
9. Set **Web Origins** to `+`, which means to use the URIs in the `Valid Redirect URIs` entry.
33+
10. Now click **Save** at the bottom of the page
34+
11. Go to the **Credentials** tab and copy the `Secret` (You will need this one later too)
35+
36+
### Configure the Keycloak strategy in Wiki.js
37+
1. If you're not already there. Go to the Administration area of your wiki, click on `Authentication` in the left navigation menu
38+
2. Click on **Keycloak**
39+
3. Enter the **Host**, which is the domain (incl. the scheme) of your Keycloak server (Example: `https://keycloak.example.com`)
40+
4. Enter the **Realm**, which is the realm you are using in Keycloak (Default is: `master`)
41+
5. Enter the **Client Id**, which is the `Client ID` from Keycloak
42+
6. Enter the **Client Secret**, which is the `Secret` from Keycloak
43+
7. Enter the **Authorization Endpoint URL**, which is `https://keycloak.example.com/auth/realms/master/protocol/openid-connect/auth`
44+
8. Enter the **Token URL**, which is `https://keycloak.example.com/auth/realms/master/protocol/openid-connect/token`
45+
9. Enter the **User Info URL**, which is `https://keycloak.example.com/auth/realms/master/protocol/openid-connect/userinfo`
46+
10. If you want the user to be logged out of Keycloak when logging out of Wiki.js, enable `Logout from Keycloak on Logout`
47+
11. Enter the `Logout Endpoint URL`, which is `https://keycloak.example.com/auth/realms/master/protocol/openid-connect/logout`
48+
12. Check **Allow self-registration** to enable the Keycloak login button, and auto create users as they login for the first time.
49+
13. Remember to add a group with at least read permissions in the **Assign to group** list
50+
14. Click `Apply` in the top-right corner and try to login
51+
52+
### Seamless login
53+
If the login worked, you can enable `Bypass Login Screen` under the `Security` tab in the left navigation menu.
54+
Make sure the Keycloak provider is at the top of the list in the `Authentication` tab.
55+
56+
![](https://static.requarks.io/logo/keycloak.svg =x50){.align-abstopright}

0 commit comments

Comments
 (0)