foliolib.folio.api.passwordValidator.Validatorregistry

class foliolib.folio.api.passwordValidator.Validatorregistry(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioApi

Validator Registry

Parameters
  • tenant (str) – Tenant id

  • okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

Methods

gettenantrulebyid(ruleId)

GET /tenant/rules/{ruleId}

gettenantrules(**kwargs)

Get a list of existing validation rules for a tenant

posttenantrules(validationRule)

Add a rule to a tenant

puttenantrule(validationRule)

Enable/disable/change the rule

gettenantrulebyid(ruleId)

GET /tenant/rules/{ruleId}

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestNotFound – Rule not found

  • OkapiFatalError – Internal server error

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Rule Schema",
    "type": "object",
    "properties": {
        "id": {
            "description": "Rule id",
            "type": "string"
        },
        "ruleId": {
            "description": "Rule id",
            "type": "string"
        },
        "name": {
            "description": "Rule name",
            "type": "string"
        },
        "type": {
            "description": "Rule type: RegExp or Programmatic or PwnedPassword",
            "type": "string",
            "enum": [
                "RegExp",
                "Programmatic",
                "PwnedPassword"
            ]
        },
        "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": {
            "description": "Entity metadata",
            "type": "object",
            "$ref": "metadata.json"
        }
    },
    "additionalProperties": false,
    "required": [
        "name",
        "type",
        "validationType",
        "state",
        "moduleName",
        "orderNo"
    ]
}
gettenantrules(**kwargs)

Get a list of existing validation rules for a tenant

GET /tenant/rules

Keyword Arguments
  • offset (int) – Skip over a number of elements by specifying an offset value for the query (default: 0, minimum: 0, maximum: 2147483647)

  • limit (int) – Limit the number of elements returned in the response (default: 10, minimum: 0, maximum: 2147483647)

  • query (str) – A query string to filter rules based on matching criteria in fields.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestUnprocessableEntity – Validation errors

  • OkapiFatalError – Internal server error

Schema

{
    "$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": "validationRule.json"
            }
        },
        "totalRecords": {
            "type": "integer"
        }
    },
    "additionalProperties": false,
    "required": [
        "rules",
        "totalRecords"
    ]
}
posttenantrules(validationRule)

Add a rule to a tenant

POST /tenant/rules

Parameters

validationRule (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestUnprocessableEntity – Validation errors

  • OkapiFatalError – Internal server error

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Rule Schema",
    "type": "object",
    "properties": {
        "id": {
            "description": "Rule id",
            "type": "string"
        },
        "ruleId": {
            "description": "Rule id",
            "type": "string"
        },
        "name": {
            "description": "Rule name",
            "type": "string"
        },
        "type": {
            "description": "Rule type: RegExp or Programmatic or PwnedPassword",
            "type": "string",
            "enum": [
                "RegExp",
                "Programmatic",
                "PwnedPassword"
            ]
        },
        "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": {
            "description": "Entity metadata",
            "type": "object",
            "$ref": "metadata.json"
        }
    },
    "additionalProperties": false,
    "required": [
        "name",
        "type",
        "validationType",
        "state",
        "moduleName",
        "orderNo"
    ]
}
puttenantrule(validationRule)

Enable/disable/change the rule

PUT /tenant/rules

Parameters

validationRule (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Rule not found

  • OkapiFatalError – Internal server error

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Rule Schema",
    "type": "object",
    "properties": {
        "id": {
            "description": "Rule id",
            "type": "string"
        },
        "ruleId": {
            "description": "Rule id",
            "type": "string"
        },
        "name": {
            "description": "Rule name",
            "type": "string"
        },
        "type": {
            "description": "Rule type: RegExp or Programmatic or PwnedPassword",
            "type": "string",
            "enum": [
                "RegExp",
                "Programmatic",
                "PwnedPassword"
            ]
        },
        "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": {
            "description": "Entity metadata",
            "type": "object",
            "$ref": "metadata.json"
        }
    },
    "additionalProperties": false,
    "required": [
        "name",
        "type",
        "validationType",
        "state",
        "moduleName",
        "orderNo"
    ]
}