diff --git a/.github/img/foot-size-execution-config-tooltip.png b/.github/img/foot-size-execution-config-tooltip.png new file mode 100644 index 0000000..fd4e54b Binary files /dev/null and b/.github/img/foot-size-execution-config-tooltip.png differ diff --git a/.github/img/foot-size-form-config.png b/.github/img/foot-size-form-config.png new file mode 100644 index 0000000..0e08d76 Binary files /dev/null and b/.github/img/foot-size-form-config.png differ diff --git a/.github/img/foot-size-form-error.png b/.github/img/foot-size-form-error.png new file mode 100644 index 0000000..99ac9c2 Binary files /dev/null and b/.github/img/foot-size-form-error.png differ diff --git a/.github/img/foot-size-form.png b/.github/img/foot-size-form.png new file mode 100644 index 0000000..b5be397 Binary files /dev/null and b/.github/img/foot-size-form.png differ diff --git a/.github/img/new-authenticator-execution.png b/.github/img/new-authenticator-execution.png new file mode 100644 index 0000000..f9efc9b Binary files /dev/null and b/.github/img/new-authenticator-execution.png differ diff --git a/.github/workflows/automation-tests.yml b/.github/workflows/automation-tests.yml index b5b0628..44383b1 100644 --- a/.github/workflows/automation-tests.yml +++ b/.github/workflows/automation-tests.yml @@ -19,13 +19,13 @@ jobs: distribution: 'adopt' - name: Set version from git commit SHA - run: mvn -B -ntp versions:set -DgenerateBackupPoms=false -DnewVersion="${GITHUB_SHA::6}" + run: mvn -B -ntp versions:set -DgenerateBackupPoms=false -DnewVersion="${GITHUB_SHA::7}" - name: Build authenticator jar file run: mvn -B -ntp package - name: Build test docker container - run: docker-compose build --build-arg VERSION="${GITHUB_SHA::6}" + run: docker-compose build --build-arg VERSION="${GITHUB_SHA::7}" - name: Run automation tests run: mvn -B -ntp test -P automation-tests -D selenide.headless=true diff --git a/README.md b/README.md index d2704f9..c68a015 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Keycloak username password attribute +# Keycloak username password attribute authenticator [![automation tests](https://github.com/kilmajster/keycloak-username-password-attribute-authenticator/actions/workflows/automation-tests.yml/badge.svg)](https://github.com/kilmajster/keycloak-username-password-attribute-authenticator/actions/workflows/automation-tests.yml) ![Maven Central](https://img.shields.io/maven-central/v/io.github.kilmajster/keycloak-username-password-attribute-authenticator) ![Docker Image Version (latest by date)](https://img.shields.io/docker/v/kilmajster/keycloak-username-password-attribute-authenticator?label=docker%20hub) @@ -6,37 +6,119 @@ ![GitHub](https://img.shields.io/github/license/kilmajster/keycloak-username-password-attribute-authenticator) ## Description -Keycloak default login form with user attribute validation. +Keycloak default login form with additional user attribute validation. Example: -## How 2 use +
+ + + +
+ +## Usage To use this authenticator, it should be bundled together with Keycloak, here are two ways how to do that: -### using jar +### Deploying jar file +To deploy custom Keycloak extension it needs to be placed in `{$KEYCLOAK_PATH}/standalone/deployments/`. +Latest authenticator jar file can be downloaded from +[Github Releases](https://github.com/kilmajster/keycloak-username-password-attribute-authenticator/releases/latest) page or +[Maven Central Repository](https://mvnrepository.com/artifact/io.github.kilmajster/keycloak-username-password-attribute-authenticator/latest). +### Using Docker init container +If you want to use this authenticator in cloud environment, here is ready [init container](https://hub.docker.com/r/kilmajster/keycloak-username-password-attribute-authenticator). +Jar file is placed in `/opt/jboss/keycloak/standalone/deployments`, so same location as target one. +According to official Keycloak [example](https://github.com/codecentric/helm-charts/blob/master/charts/keycloak/README.md#providing-a-custom-theme), +Helm chart could look like following: +```yaml +extraInitContainers: | + - name: attribute-authenticator-provider + image: kilmajster/keycloak-username-password-attribute-authenticator:latest + imagePullPolicy: IfNotPresent + command: + - sh + args: + - -c + - | + echo "Copying attribute authenticator..." + cp -R /opt/jboss/keycloak/standalone/deployments/*.jar /attribute-authenticator + volumeMounts: + - name: attribute-authenticator + mountPath: /attribute-authenticator -### using docker init container -If you want to use this authenticator in some cloud envirenement, here is ready init container. Jar file is placed in `/opt/jboss/keycloak/standalone/deployments`, -so same location as target one. Possible -``` -kilmajster/keycloak-username-password-attribute-authenticator:latest -``` -#### example helm chart snippet +extraVolumeMounts: | + - name: attribute-authenticator + mountPath: /opt/jboss/keycloak/standalone/deployments + +extraVolumes: | + - name: attribute-authenticator + emptyDir: {} +``` ## Configuration -### Authenticator config -#### config via Keycloak UI / API +### Authentication configuration ++ +
+ ++ +
+ +#### Minimal configuration - login_form_user_attribute -- login_form_generate_label -- login_form_attribute_label -#### config via env variables -- LOGIN_FORM_USER_ATTRIBUTE ++ +
+ +#### Advanced configuration + - login_form_generate_label + - login_form_attribute_label + - login_form_error_message + - clear_user_on_attribute_validation_fail +##### config via Keycloak API +TODO +##### Configuration via environment variables - LOGIN_FORM_GENERATE_LABEL - LOGIN_FORM_ATTRIBUTE_LABEL +- LOGIN_FORM_ERROR_MESSAGE +- CLEAR_USER_ON_ATTRIBUTE_VALIDATION_FAIL -### Theme config +### Theme configuration #### Using bundled default keycloak theme + - choose theme `base-with-attribute` + - override authentication flow to `Browser with user attribute` + #### Extending own theme +```html +... +