42.0.0 • Published 3 years ago

keycloak-react-theming v42.0.0

Weekly downloads
560
License
MIT
Repository
github
Last release
3 years ago

!!! This module is under active developement. It is not usable yet!!!

Motivations

The problem:

keycloak_before

When we redirected to Keycloak the user suffers from a harsh context switch. On je login/register pages the language is set back to default and the theme is different that the one on the app.

Keycloak does offer a way to customize theses pages but it requires a lot of raw HTML/CSS hacking to reproduce the look and feel of a specific app. Not mentioning the maintenance cost of such an endeavour.

Wouldn't it be great if we could just design the login and register pages as if they where part of our app while still letting Keycloak handle the heavy lifting of actually authenticating the users?

Here is yarn add keycloak-react-theming for you 🍸

TODO: Insert video after.

How to use

Setting up the build tool

Add keycloak-react-theming to the dev dependencies of your project npm install --save-dev keycloak-react-theming or yarn add --dev keycloak-react-theming then configure your package.json build's script to build the keycloak's theme by adding && build-keycloak-theme.

Typically you will get:

package.json:

  "devDependencies": {
    "keycloak-react-theming": "^0.0.10"
  },
  "scripts": {
    "build": "react-scripts build && build-keycloak-theme"
  },

Then build your app with yarn run build or npm run build, you will be provided with instructions about how to load the theme into Keycloak.

kickstart_video

Developing your login and register pages in your React app

TODO

How to implement context persistance

If you want dark mode preference, language and others users preferences your can do so very easily by using powerhooks/useGlobalState

WARNING: powerhooks is still a work in progress.

REQUIREMENTS

This tools assumes you are bundling your app with Webpack (tested with 4.44.2) . It assumes there is a build/ directory at the root of your react project directory containing a index.html file and a static/ directory generated by webpack.

All this is defaults with create-react-app (tested with 4.0.3=)

  • For building the theme: mvn (Maven) must be installed
  • For development, (testing the theme in a local container ): rm, mkdir, wget, unzip are assumed to be available and docker up and running.

NOTE: This build tool has only be tested on MacOS.

API Reference

The build tool

Part of the lib that runs with node, at build time.

  • npx build-keycloak-theme: Builds the theme, the CWD is assumed to be the root of your react project.
  • npx download-sample-keycloak-themes: Downloads the keycloak default themes (for development purposes)

The fronted lib ( imported into your react app )

Part of the lib that you import in your react project and runs on the browser.

TODO

42.0.0

3 years ago

0.0.33

3 years ago

0.0.31

3 years ago

0.0.32

3 years ago

0.0.30

3 years ago

0.0.29

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago