Shibboleth Reference Guide

JavaScript Client

Methods

constructor
Parameters:
A JavaScript object containing the following:
captchaId:
string | the CAPTCHA id
type:
string | CAPTCHA type
elementId:
string | the id of the element the CAPTCHA be attached to
displayInformation:
A JavaScript object | information supplied by NetToolKit's Shibboleth service about how the CAPTCHA should be rendered (to be passed to the JavaScript client)
inputElement:
Element | (optional) | a custom input for traditional CAPTCHAs. Must be an input element or an element with a single input element as a child.

getId
Parameters:
none
Return Value:
string | CAPTCHA id

getUserAttempt
Parameters:
none
Return Value:
string | key for the CAPTCHA

Constants

type

BASIC

DATE

MATH

NAVAL_COMMAND

PATH

SPLIT

SPOTTER

SUBSTRING

Server

Captcha Options

Options can be specified as a JSON object that is passed as the value of the options parameter in a POST request. See Quick Start for a detailed example.

We have developed a Java client to simplify some of these operations. If you'd like to access this client please contact us.

Basic
A JSON object containing the following:
size:
string | (optional) | size of the CAPTCHA ("small", "medium" or "large") | default: "medium"
backgroundColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the background color of the CAPTCHA | default: ["fafafa"]
textColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the text color of the CAPTCHA | default: ["9b1111"]
includeLineBackground:
boolean | (optional) | if true, the CAPTCHA will have a background of colorful lines | default: false
lineColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the in the line background of the CAPTCHA | default: ["9b1111", "2d5fc4", "e27909", "027a36", "424242", "35259b", "22730e"]
validCharacters:
array of characters | (optional) | a set of characters eligible to be included in the CAPTCHA | default: ['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'n', 'r', 't', 'y', 'A', 'B', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'N', 'Q', 'R', 'T', 'Y', '3', '4', '6', '7', '8']
Date
A JSON object containing the following:
size:
string | (optional) | size of the CAPTCHA ("small", "medium" or "large") | default: "medium"
backgroundColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the background color of the CAPTCHA | default: ["fafafa"]
Math
A JSON object containing the following:
size:
string | (optional) | size of the CAPTCHA ("small", "medium" or "large") | default: "medium"
backgroundColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the background color of the CAPTCHA | default: ["fafafa"]
textColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the text color of the CAPTCHA | default: ["9b1111", "2d5fc4", "e27909", "027a36", "424242", "35259b", "22730e"]
includeLineBackground:
boolean | (optional) | if true, the CAPTCHA will have a background of colorful lines | default: false
lineColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the in the line background of the CAPTCHA | default: ["9b1111", "2d5fc4", "e27909", "027a36", "424242", "35259b", "22730e"]
includeParentheses:
boolean | (optional) | if true, expressions with more than two terms will use parentheses | default: true
Naval Command
A JSON object containing the following:
size:
string | (optional) | size of the CAPTCHA ("small", "medium" or "large") | default: "medium"
backgroundColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the background color of the CAPTCHA | default: ["22347d"]
Path
A JSON object containing the following:
size:
string | (optional) | size of the CAPTCHA ("small", "medium" or "large") | default: "medium"
backgroundColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the background color of the CAPTCHA | default: ["333333"]
resetText:
string | (optional) | the text to be displayed on the reset button | default: "Start over"
minPathLength:
number | (optional) | minimum length for the path (must be greater than 2 and less than 21) | default: 10
maxPathLength:
number | (optional) | maximum length for the path (must be greater than 2 and less than 21) | default: 15
pathColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the color of the path | default: ["808080"]
squareColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the color of the moveable square | default: ["ff0000"]
Split
A JSON object containing the following:
size:
string | (optional) | size of the CAPTCHA ("small", "medium" or "large") | default: "medium"
backgroundColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the background color of the CAPTCHA | default: ["e5e5e5"]
resetText:
string | (optional) | the text to be displayed on the reset button | default: "Start over"
imageSets:
array of strings | (optional) | which sets of images should be included (options are "pictures" or "strings") | default: ["pictures", "strings"]
Spotter
A JSON object containing the following:
size:
string | (optional) | size of the CAPTCHA ("small", "medium" or "large") | default: "medium"
backgroundColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the background color of the CAPTCHA | default: ["fafafa"]
resetText:
string | (optional) | the text to be displayed on the reset button | default: "Start over"
minKeyShapes:
number | (optional) | minimum number of key shapes to be included (must be greater than 0 and less than 21) | default: 3
maxKeyShapes:
number | (optional) | minimum number of key shapes to be included (must be greater than 0 and less than 21) | default:5
minShapes:
number | (optional) | minimum number of total shapes to be included (must be greater than 0 and less than 21) | default: 10
maxShapes:
number | (optional) | minimum number of total shapes to be included (must be greater than 0 and less than 21) | default: 15
keyShapes:
array of strings | (optional) | which types of shapes are eligible to be the key shape (options are "circle", "star", "square" or "triangle") | default: ["circle", "star", "triangle", "square"]
nonKeyShapes:
array of strings | (optional) | which types of shapes are eligible to be non-key shapes (options are "circle", "star", "square" or "triangle") | default: ["circle", "star", "triangle", "square"]
includeLineBackground:
boolean | (optional) | if true, the CAPTCHA will have a background of colorful lines | default: false
lineColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the in the line background of the CAPTCHA | default: ["9b1111", "2d5fc4", "e27909", "027a36", "424242", "35259b", "22730e"]
onlyIncludeKeyShape:
boolean | (optional) | if true, only the key shape type will be included | default: false
shapeColors:
array of hexadecimal color code strings | (optional) | a set of colors for the shapes | default: ["9b1111", "2d5fc4", "e27909", "027a36", "424242", "35259b", "22730e"]
Substring
A JSON object containing the following:
size:
string | (optional) | size of the CAPTCHA ("small", "medium" or "large") | default: "medium"
backgroundColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the background color of the CAPTCHA | default: ["fafafa"]
textColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the text color of the CAPTCHA | default: ["9b1111"]
includeLineBackground:
boolean | (optional) | if true, the CAPTCHA will have a background of colorful lines | default: false
lineColors:
array of hexadecimal color code strings | (optional) | a set of colors eligible to be the in the line background of the CAPTCHA | default: ["9b1111", "2d5fc4", "e27909", "027a36", "424242", "35259b", "22730e"]