mirror of
https://github.com/p08dev/keycloak-hcaptcha.git
synced 2026-06-21 14:43:50 +02:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7be998a4bf | |||
| 47acd5b828 | |||
| 78d30a1ad9 | |||
| e1c5358b82 | |||
| 4ce3f58ad2 | |||
| 7bbd3d3a57 | |||
| a72db7659e | |||
| 8590495a05 | |||
| 5464dcd925 | |||
| 38d3d3d521 | |||
| 74cb564ab9 | |||
| 42f5a2318e |
26
README.md
26
README.md
@ -1,10 +1,12 @@
|
||||
# keycloak-hcaptcha
|
||||
|
||||
> I am currently not adding any new features, updates or fixes. Feel free to open a PR!
|
||||
|
||||
To safeguard registration against bots, Keycloak has integration with Google reCAPTCHA. This provides similar functionality, but with a more privacy friendly provider named hCaptcha. The code is based on the vanilla implementation of reCAPTCHA in Keycloak.
|
||||
|
||||
## Installation
|
||||
|
||||
Download the newest release JAR (or comile it yourself) and drop it into `your_keycloak_installation/standalone/deployments`
|
||||
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.
|
||||
|
||||
@ -26,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??>
|
||||
<div class="form-group">
|
||||
<div class="${properties.kcInputWrapperClass!}">
|
||||
@ -44,5 +46,25 @@ In the last step you have to change the registration flow to the newly created o
|
||||
Authentication Bindings
|
||||

|
||||
|
||||
## 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)
|
||||
|
||||
34
pom.xml
34
pom.xml
@ -2,41 +2,59 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.itrupp.p8</groupId>
|
||||
<artifactId>keycloak-hcaptcha</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1</version>
|
||||
<name>Registration Authenitcation Execution Provider for hCaptcha</name>
|
||||
<description>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.</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<version.keycloak>15.0.2</version.keycloak>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<version.keycloak>22.0.5</version.keycloak>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<version>${version.keycloak}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-core</artifactId>
|
||||
<version>${version.keycloak}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-server-spi</artifactId>
|
||||
<version>${version.keycloak}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-server-spi-private</artifactId>
|
||||
<version>${version.keycloak}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-services</artifactId>
|
||||
<version>${version.keycloak}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user