Overriding UI elements
Authenticators providing UI implement the same pattern regarding styling. It is possible to style a single authenticator and/or use a global pattern making all authenticators use the same styles.
Making the authenticator read the updated files
In order to make the authenticator read the custom file instead of the default file the configuration parameter overlay_dir must be used on each authenticator.
Add parameter "overlay_dir":
<path_to_custom_directory
>
.
In the custom directory create a folder, "assets
", and place the updated file. Restart system.
It is possible to use the same override file for multiple authenticators.
Favicon
in the assets
folder of your overlay_dir
, place the favicon.ico
.
All of the authenticator frontend/UI applications use the same type of configuration files.
The preferred way of configuring the files is using the overlay_dir.
css_overrides.css
Configure the css_overrides.css
file in the assets/
folder of your overlay_dir
The file is empty by default. To override the css variables used in the applications see all the default values below. Note, if you wish to only override for example the button background color you do not need to include the rest of the variables.
Default values/available variables
Examples
Example: To update the button backgrounds define in your css_overrides.css
:
Example: To change background image
Make sure image is available in the assets
folder (using the overlay method preferably) and define in your css_overrides.css
ui_config_overrides.json
Configure the ui_config_overrides.json
. Use overlay to provide the custom file and place the file in <overlay_dir>/assets/ui_config_overrides.json
. The data in ui_config_overrides.json
will be merged with the default values (below)
Customizing translations
There are two possible ways to customize the locale files, either by
Overlaying locale files completely, providing all translation keys.
Merging the default locale file with a custom file. The default file will be merged with the custom file, with the keys in the custom file taking precedence.
Add more languages
Default provided languages are English and Swedish. Language files must be present in <overlay_dir>
/assets/locales/
E.g. assets/locales/en.json
To add more languages add to the array in supportedLanguages
and place file (using overlay method) in locales folder. E.g. add the following to the supportedLanguages
array {code: 'de', name: 'Deutsch'}
and add a file called assets/locales/de.json
Custom translation keys
To customize translations the files can be overlayed to specify different complete file with all translation keys, or use localesMergePath
to extend and merge with the provided default files.
Useful when overriding specific translation keys only, and not having to provide all translation keys.
If one single file is used for multiple authenticators/applications, where you define all strings to be overridden in the same file, you can either 1. use the same overlay_dir for all authenticators/applications, or, 2. use /authn/assets/locales/
and overlay there.
Exemple of custom extension/merge:
Default language file contains the translations keys
The overlay_dir
contains a ui_config_overrides.json
with localesMergePath: "assets/custom_locales/"
(see ui_config_overrides
above)
A file is placed in <overlay_dir>/assets/custom_locales/en.json
containing the following:
The resulting merged language file used in the application will contain the following:
For each language that will be customized, add language files <overlay_dir>/assets/custom_locales/<lang>.json