BotDetect Java CAPTCHA Core API Reference
While the BotDetect Web API members are used for Captcha functionality within a Java web form context (dealing with markup generation and related tasks), the core BotDetect API contains members related to general Captcha functionality, independent of the context it's used for.
com.captcha.botdetect.internal.core.CaptchaBase
A base Captcha object, representing a generic Captcha instance capable of generating Captcha codes, images and sounds + validating user inputs. The Captcha instances tailored for Java form use all delegate core Captcha functionality to a contained CaptchaBase
instance.
CaptchaBase Class Reference | ||
---|---|---|
CaptchaBase
|
Captcha identifier, distinguishing multiple Captcha instances within the system. Each Captcha used in a different location must have a unique identifier | |
String get/set CaptchaId | Captcha identifier, distinguishing multiple Captcha instances within the system. Can also be accessed through this property, after being initialized in the constructor | |
int get/set CodeLength | Number of characters in randomly generated Captcha codes (answers to Captcha challenges). The default value is random (4-6 characters) | |
CodeStyle get/set CodeStyle | Character types, used to generate random Captcha codes. The default value is Alphanumeric | |
String set DisallowedCodeSubstringsCsv | Strings that should never occur in randomly generated Captcha codes. Can be both single characters (allows Captcha character set customization) and sequences of two or more characters (useful for swear words filtering, avoiding particular hard-to-read sequences etc.). The default value is empty (Captcha code filtering is optional) | |
List<String> set DisallowedCodeSubstringsList | Strings that should never occur in randomly generated Captcha codes. Can be both single characters (allows Captcha character set customization) and sequences of two or more characters (useful for swear words filtering, avoiding particular hard-to-read sequences etc.). The default value is empty (Captcha code filtering is optional) | |
int get/set CodeTimeout | The time period after random Captcha code generation during which Captcha challenges based on it can be solved: when it expires, even correct inputs will be considered as invalid submissions. The default value is 1200 seconds (20 minutes) | |
List<ImageStyle> get/set ImageStyle | Image style, The BotDetect drawing algorithm used to render Captcha codes in image Captcha challenges. The default value is random (an image style is chosen from all available values for each Captcha image generated) | |
ImageSize get/set ImageSize | Size of Captcha image challenges generated. The default value is 250 x 50 pixels | |
ImageFormat get/set ImageFormat | Image format in which Captcha images will be generated and sent to the client. The default value is Jpeg | |
java.awt.Color get/set CustomDarkColor | Optional custom dark color point, modifies the color palette used for Captcha image drawing | |
java.awt.Color get/set CustomLightColor | Optional custom light color point, modifies the color palette used for Captcha image drawing | |
boolean is/set SoundEnabled | Is Captcha sound enabled. The default value is true | |
List<SoundStyle>SoundStyle get/set SoundStyle | The BotDetect audio generation algorithm used to pronounce Captcha codes in sound Captcha challenges. The default value is random (a sound style is chosen from all available values for each Captcha sound generated) | |
SoundFormat get/set SoundFormat | Audio format Captcha sounds will be generated and sent to the client. The default value is WAV_PCM_16BIT_8KHZ_MONO | |
SoundRegenerationMode get/set SoundRegenerationMode | How will multiple consecutive requests for audio Captcha with the same Captcha code ('sound regeneration') be handled by BotDetect - a tradeoff of security, usability, and storage requirements. The default value is |
|
String get/set Locale | Captcha locale string, determining the exact character set used for random Captcha code generation and the pronunciation language used for sound Captcha generation. The default value is en-US | |
boolean is/set HelpLinkEnabled | Will Captcha markup include a link to a Captcha help page providing Captcha instructions and explanations for form users. The default value is true | |
HelpLinkMode get/set HelpLinkMode | How will the Captcha help link be displayed. The default value is TEXT | |
String get InstanceId | Globally unique identifier of the current CaptchaBase object instance | |
static final String VALID_CAPTCHA_ID | The global regular expression object used to validate CaptchaId values and ensure they match the persistence medium key limitations | |
Code getCode
|
Generates a random Captcha code for the given purpose, using settings stored in instance data belonging to the specified instanceId | |
java.io.ByteArrayOutputStream getImage
|
Generates a Captcha image, using settings stored in instance data belonging to the specified instanceId | |
java.io.ByteArrayOutputStream getSound
|
Generates a Captcha sound, using settings stored in instance data belonging to the specified instanceId | |
boolean validate
|
Compares the user input to the Captcha code stored for the given instanceId, using validation rules specified for the current ValidationAttemptOrigin |
com.captcha.botdetect.CaptchaRandomization
A helper class used for easy randomization of Captcha parameters.
CaptchaRandomization Class Reference | ||
---|---|---|
static int getRandomCodeLength | Returns a random Captcha code length, using default code length bounds | |
static int getRandomCodeLength
|
Returns a random Captcha code length, using the default minimal value and the specified maximal value | |
static int getRandomCodeLength
|
Returns a random Captcha code length, using the specified minimal and maximal values | |
static CodeStyle getRandomCodeStyle
|
Returns a random Captcha code style. Selects from all available styles if no parameter is specified, or from the given value set if specified | |
static ImageStyle getRandomImageStyle | Returns a random Captcha image style, using all available styles | |
static ImageStyle getRandomImageStyle
|
Returns a random Captcha image style. Selects from the given value set | |
static SoundStyle getRandomSoundStyle | Returns a random Captcha sound style, using all available styles | |
static SoundStyle getRandomSoundStyle
|
Returns a random Captcha sound style. Selects from the given value set |
Please Note
BotDetect Java Captcha Library v4.0.Beta3.7 is an in-progress port of BotDetect 4 Captcha, and we need you to guide our efforts towards a polished product. Please let us know if you encounter any bugs, implementation issues, or a usage scenario you would like to discuss.
Current BotDetect Versions
-
BotDetect ASP.NET CAPTCHA
2019-07-22v4.4.2 -
BotDetect Java CAPTCHA
2019-07-22v4.0.Beta3.7 -
BotDetect PHP CAPTCHA
2019-07-22v4.2.5