An open API service indexing awesome lists of open source software.

https://github.com/try0/wicket-honeypot

Adds honeypot field to the form.
https://github.com/try0/wicket-honeypot

form-validation honeypot security wicket

Last synced: 8 months ago
JSON representation

Adds honeypot field to the form.

Awesome Lists containing this project

README

          

# wicket-honeypot
Adds honeypot field to the form.

## Version

| Version | Wicket |
| ---- | ---- |
| [3.0.0](https://search.maven.org/artifact/jp.try0.wicket/wicket-honeypot-core/3.0.0/jar) | 10.x |
| [2.0.0](https://search.maven.org/artifact/jp.try0.wicket/wicket-honeypot-core/2.0.0/jar) | 9.x |
| [1.0.0](https://search.maven.org/artifact/jp.try0.wicket/wicket-honeypot-core/1.0.0/jar) | 8.x |

Wicket 10.x
```xml

jp.try0.wicket
wicket-honeypot-core
3.0.0

```

Wicket 9.x
```xml

jp.try0.wicket
wicket-honeypot-core
2.0.0

```

Wicket 8.x
```xml

jp.try0.wicket
wicket-honeypot-core
1.0.0

```

## Usage

```java
add(new Form("form") {
{
add(new HoneypotBehavior());
}
});
```

HoneypotBehavior uses JavaScript on the client side to add a honeypot field to the form. The added field is of type text and will be hidden using styles.

```html

```

The field addition process can be executed with a delay.
For example, this code determines that requests made within two seconds of the screen being displayed are bot actions.

```java
add(new Form("form") {
{
int delayMs = 2000;
add(new HoneypotBehavior(delayMs));
}
});
```

To display a message and request form resubmission when a user action is mistakenly identified as a bot action, please override the onError method.

```java
add(new Form("form") {
{
int delayMs = 2000;
add(new HoneypotBehavior(delayMs) {
@Override
protected void onError(Form> form) {
form.error(HomePage.this.getString("honeypot_error_message")); // TODO your prop key
}
});
}
});
```

With other configs.

```java
add(new Form("form") {
{
// custom config
HoneypotBehaviorConfig config = new HoneypotBehaviorConfig();
// the field addition process can be executed with a delay.
// default: 0
config.setDelay(1500);
// honeypot field autocomplete attr.
// default: one-time-code
config.setAutocomplete("one-time-code");
// block submit on the client.
// default: false
config.setBlockSubmit(true);
// If none of [keydown, mousemove, touchstart, touchmove, scroll] events are detected, assume the user is a bot.
// default: false
config.setDetectHumanActivity(true);

add(new HoneypotBehavior(config));
}
});
```