Validator Registry

http://github.com/org/folio/mod-password-validator

Table of contents

Validator Registry API

This component manages password validation rules.

/tenant/rules

GET /tenant/rules

Get a list of existing validation rules for a tenant

GET /tenant/rules
Query Parameters
  • offset: (integer - default: 0 - minimum: 0 - maximum: 2147483647)

    Skip over a number of elements by specifying an offset value for the query

    Example:

    0
  • limit: (integer - default: 10 - minimum: 0 - maximum: 2147483647)

    Limit the number of elements returned in the response

    Example:

    10
  • query: (string)

    A query string to filter rules based on matching criteria in fields.

Response 200

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Rules Collection",
  "type": "object",
  "properties": {
    "rules": {
      "description": "List of rules",
      "type": "array",
      "id": "ruleList",
      "items": {
        "type": "object",
        "$ref": "rule.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "rules",
    "totalRecords"
  ]
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

POST /tenant/rules

Add a rule to a tenant

POST /tenant/rules
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Rule Schema",
  "type": "object",
  "properties": {
    "ruleId": {
      "description": "Rule id",
      "type": "string"
    },
    "name": {
      "description": "Rule name",
      "type": "string"
    },
    "type": {
      "description": "Rule type: RegExp or Programmatic",
      "type": "string",
      "enum": [
        "RegExp",
        "Programmatic"
      ]
    },
    "validationType": {
      "description": "Validation type: Strong or Soft. In case of soft rule validation failure the password processing can be continued",
      "type": "string",
      "enum": [
        "Soft",
        "Strong"
      ]
    },
    "state": {
      "description": "Rule state: Enabled or Disabled",
      "type": "string",
      "enum": [
        "Enabled",
        "Disabled"
      ]
    },
    "moduleName": {
      "description": "Name of the module",
      "type": "string"
    },
    "implementationReference": {
      "description": "For Programmatic rules ImplementationReference reflects the approach to call particular validation implementation whether it REST endpoint or local service",
      "type": "string"
    },
    "expression": {
      "description": "For RegExp type contains the actual expression",
      "type": "string"
    },
    "description": {
      "description": "Validation rule description",
      "type": "string"
    },
    "orderNo": {
      "description": "Defines the order of rule processing",
      "type": "integer"
    },
    "errMessageId": {
      "description": "message identifier which should be returned to UI in case the rule validation fails",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "name",
    "type",
    "validationType",
    "state",
    "moduleName",
    "orderNo"
  ]
}

Response 201

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Rule Schema",
  "type": "object",
  "properties": {
    "ruleId": {
      "description": "Rule id",
      "type": "string"
    },
    "name": {
      "description": "Rule name",
      "type": "string"
    },
    "type": {
      "description": "Rule type: RegExp or Programmatic",
      "type": "string",
      "enum": [
        "RegExp",
        "Programmatic"
      ]
    },
    "validationType": {
      "description": "Validation type: Strong or Soft. In case of soft rule validation failure the password processing can be continued",
      "type": "string",
      "enum": [
        "Soft",
        "Strong"
      ]
    },
    "state": {
      "description": "Rule state: Enabled or Disabled",
      "type": "string",
      "enum": [
        "Enabled",
        "Disabled"
      ]
    },
    "moduleName": {
      "description": "Name of the module",
      "type": "string"
    },
    "implementationReference": {
      "description": "For Programmatic rules ImplementationReference reflects the approach to call particular validation implementation whether it REST endpoint or local service",
      "type": "string"
    },
    "expression": {
      "description": "For RegExp type contains the actual expression",
      "type": "string"
    },
    "description": {
      "description": "Validation rule description",
      "type": "string"
    },
    "orderNo": {
      "description": "Defines the order of rule processing",
      "type": "integer"
    },
    "errMessageId": {
      "description": "message identifier which should be returned to UI in case the rule validation fails",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "name",
    "type",
    "validationType",
    "state",
    "moduleName",
    "orderNo"
  ]
}

Response 400

Bad request

Body

Media type: text/plain

Type: any

Example:

Bad request

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

PUT /tenant/rules

Enable/disable/change the rule

PUT /tenant/rules
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Rule Schema",
  "type": "object",
  "properties": {
    "ruleId": {
      "description": "Rule id",
      "type": "string"
    },
    "name": {
      "description": "Rule name",
      "type": "string"
    },
    "type": {
      "description": "Rule type: RegExp or Programmatic",
      "type": "string",
      "enum": [
        "RegExp",
        "Programmatic"
      ]
    },
    "validationType": {
      "description": "Validation type: Strong or Soft. In case of soft rule validation failure the password processing can be continued",
      "type": "string",
      "enum": [
        "Soft",
        "Strong"
      ]
    },
    "state": {
      "description": "Rule state: Enabled or Disabled",
      "type": "string",
      "enum": [
        "Enabled",
        "Disabled"
      ]
    },
    "moduleName": {
      "description": "Name of the module",
      "type": "string"
    },
    "implementationReference": {
      "description": "For Programmatic rules ImplementationReference reflects the approach to call particular validation implementation whether it REST endpoint or local service",
      "type": "string"
    },
    "expression": {
      "description": "For RegExp type contains the actual expression",
      "type": "string"
    },
    "description": {
      "description": "Validation rule description",
      "type": "string"
    },
    "orderNo": {
      "description": "Defines the order of rule processing",
      "type": "integer"
    },
    "errMessageId": {
      "description": "message identifier which should be returned to UI in case the rule validation fails",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "name",
    "type",
    "validationType",
    "state",
    "moduleName",
    "orderNo"
  ]
}

Response 200

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Rule Schema",
  "type": "object",
  "properties": {
    "ruleId": {
      "description": "Rule id",
      "type": "string"
    },
    "name": {
      "description": "Rule name",
      "type": "string"
    },
    "type": {
      "description": "Rule type: RegExp or Programmatic",
      "type": "string",
      "enum": [
        "RegExp",
        "Programmatic"
      ]
    },
    "validationType": {
      "description": "Validation type: Strong or Soft. In case of soft rule validation failure the password processing can be continued",
      "type": "string",
      "enum": [
        "Soft",
        "Strong"
      ]
    },
    "state": {
      "description": "Rule state: Enabled or Disabled",
      "type": "string",
      "enum": [
        "Enabled",
        "Disabled"
      ]
    },
    "moduleName": {
      "description": "Name of the module",
      "type": "string"
    },
    "implementationReference": {
      "description": "For Programmatic rules ImplementationReference reflects the approach to call particular validation implementation whether it REST endpoint or local service",
      "type": "string"
    },
    "expression": {
      "description": "For RegExp type contains the actual expression",
      "type": "string"
    },
    "description": {
      "description": "Validation rule description",
      "type": "string"
    },
    "orderNo": {
      "description": "Defines the order of rule processing",
      "type": "integer"
    },
    "errMessageId": {
      "description": "message identifier which should be returned to UI in case the rule validation fails",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "name",
    "type",
    "validationType",
    "state",
    "moduleName",
    "orderNo"
  ]
}

Response 400

Bad request

Body

Media type: text/plain

Type: any

Example:

Bad request

Response 404

Rule not found

Body

Media type: text/plain

Type: any

Example:

Rule not found

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /tenant/rules/{ruleId}

GET /tenant/rules/{ruleId}
URI Parameters
  • ruleId: required (string)

Response 200

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Rule Schema",
  "type": "object",
  "properties": {
    "ruleId": {
      "description": "Rule id",
      "type": "string"
    },
    "name": {
      "description": "Rule name",
      "type": "string"
    },
    "type": {
      "description": "Rule type: RegExp or Programmatic",
      "type": "string",
      "enum": [
        "RegExp",
        "Programmatic"
      ]
    },
    "validationType": {
      "description": "Validation type: Strong or Soft. In case of soft rule validation failure the password processing can be continued",
      "type": "string",
      "enum": [
        "Soft",
        "Strong"
      ]
    },
    "state": {
      "description": "Rule state: Enabled or Disabled",
      "type": "string",
      "enum": [
        "Enabled",
        "Disabled"
      ]
    },
    "moduleName": {
      "description": "Name of the module",
      "type": "string"
    },
    "implementationReference": {
      "description": "For Programmatic rules ImplementationReference reflects the approach to call particular validation implementation whether it REST endpoint or local service",
      "type": "string"
    },
    "expression": {
      "description": "For RegExp type contains the actual expression",
      "type": "string"
    },
    "description": {
      "description": "Validation rule description",
      "type": "string"
    },
    "orderNo": {
      "description": "Defines the order of rule processing",
      "type": "integer"
    },
    "errMessageId": {
      "description": "message identifier which should be returned to UI in case the rule validation fails",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "name",
    "type",
    "validationType",
    "state",
    "moduleName",
    "orderNo"
  ]
}

Response 404

Rule not found

Body

Media type: text/plain

Type: any

Example:

Rule not found

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error