From e1c5358b828d1fd17fe1aa5c3542e4548ffbb542 Mon Sep 17 00:00:00 2001 From: mwllgr Date: Mon, 6 Nov 2023 23:46:49 +0100 Subject: [PATCH 1/3] Update used dependency for Keycloak v22 --- .../itrupp/p8/keycloak/authenticator/RegistrationhCaptcha.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/itrupp/p8/keycloak/authenticator/RegistrationhCaptcha.java b/src/main/java/de/itrupp/p8/keycloak/authenticator/RegistrationhCaptcha.java index cd54710..2c1f3a4 100644 --- a/src/main/java/de/itrupp/p8/keycloak/authenticator/RegistrationhCaptcha.java +++ b/src/main/java/de/itrupp/p8/keycloak/authenticator/RegistrationhCaptcha.java @@ -25,7 +25,7 @@ import org.keycloak.services.messages.Messages; import org.keycloak.services.validation.Validation; import org.keycloak.util.JsonSerialization; -import javax.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.MultivaluedMap; import java.io.InputStream; import java.util.ArrayList; From 78d30a1ad94b79562a2020d75a9e14fb437fd069 Mon Sep 17 00:00:00 2001 From: mwllgr Date: Mon, 6 Nov 2023 23:47:22 +0100 Subject: [PATCH 2/3] Update to Java 17 for Keycloak 22, release 1.0.1 --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index e7eaba2..8ec05f1 100644 --- a/pom.xml +++ b/pom.xml @@ -2,15 +2,15 @@ 4.0.0 de.itrupp.p8 keycloak-hcaptcha - 1.0.0 + 1.0.1 Registration Authenitcation Execution Provider for hCaptcha hCaptcha protects your users' privacy, rewards websites and helps businesses annotate their data. It's a 'drop in' replacement for reCAPTCHA that you set up in minutes. jar - 21.0.1 - 11 - 11 + 22.0.5 + 17 + 17 UTF-8 From 47acd5b8281b5d509bd682830aaef2b391bd07e1 Mon Sep 17 00:00:00 2001 From: mwllgr Date: Mon, 6 Nov 2023 23:53:29 +0100 Subject: [PATCH 3/3] Add building instructions to README --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 527a111..e9f56bb 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ To safeguard registration against bots, Keycloak has integration with Google reC ## Installation -Download the newest release JAR (or comile it yourself) and drop it into `your_keycloak_installation/providers` +Download the newest release JAR (or compile it yourself - see below) and drop it into `your_keycloak_installation/providers` There are a few steps you need to perform in the Keycloak Admin Console. Click the Authentication left menu item and go to the Flows tab. Select the Registration flow from the drop down list on this page. @@ -28,7 +28,7 @@ Authorizing Iframes To show the hCaptcha you need to modify the registration template. You can find the files in your Keycloak installation under `themes/base/login/`. If you use the user profile preview (you start your Keycloak with the `-Dkeycloak.profile=preview` flag), you need to edit the `register-user-profile.ftl`, else the `register.ftl`. Add the following code beneith the reCaptcha code: -``` +```html <#if hcaptchaRequired??>
@@ -46,5 +46,25 @@ In the last step you have to change the registration flow to the newly created o Authentication Bindings ![Step 6](img/step-06.png) +## Compiling it yourself + +Clone the repository: + +```bash +git clone https://github.com/p08dev/keycloak-hcaptcha.git +``` + +Inside the repository, compile it using Maven with Java 17: + +```bash +mvn clean compile package +``` + +You can instruct Maven to use a specific Java version by prepending the JAVA_HOME environment variable: + +```bash +JAVA_HOME=/usr/lib/jvm/java-17-oracle/ mvn clean compile package +``` + ## © License [MIT](LICENSE)