You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
918 B
41 lines
918 B
package org.ros.chatto.captcha;
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
import lombok.Builder;
|
|
|
|
@Builder
|
|
public class WebCaptcha {
|
|
private final CaptchaBehaviour captchaBehaviour;
|
|
|
|
public BufferedImage generateCaptcha() {
|
|
return captchaBehaviour.generateCaptcha();
|
|
}
|
|
|
|
public BufferedImage generateCaptcha(String captchaText) {
|
|
return captchaBehaviour.generateCaptcha(captchaText);
|
|
}
|
|
|
|
public String getRandomChars() {
|
|
return captchaBehaviour.getRandomChars();
|
|
}
|
|
|
|
public String getRandomChars(int quantity) {
|
|
return captchaBehaviour.getRandomChars(quantity);
|
|
}
|
|
}
|
|
|
|
// WebCaptcha webCaptcha = WebCaptcha.builder().captchaBehaviour(new
|
|
// SimpleCaptchaBehavior()).build();
|
|
// webCaptcha.generateCaptcha();
|
|
//
|
|
// // @formatter:off
|
|
// webCaptcha = WebCaptcha.builder()
|
|
// .captchaBehaviour(
|
|
// ManualCaptchaBehaviour.builder()
|
|
// .length(8)
|
|
// .style("black")
|
|
// .build()
|
|
// ).build();
|
|
//
|
|
// // @formatter:on
|