Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
OpenXPKI::Server::WorkUser:ContributedOPenXPKI::Server::Workflow::Validator(3)

Name
       OpenXPKI::Server::Workflow::Validator

SYNOPSIS
	 my_validator
	   class: OpenXPKI::Server::Workflow::Validator::MyValidatorClass
	   param:
	     _map_path:	[% context.key_in_context %]
	   arg:
	     - $cert_profile
	     - $cert_subject_style
	     - "[% context.other_key_in_context	%]"

Description
       A base clase for	Validators, providing some magic for handling
       parameters and arguments.

   Parameter Mapping
       All parameters (instance	configuration),	can use	the _map syntax	to
       resolve values from the context.	@see
       OpenXPKI::Server::Workflow::Activity.  Note: Validators are created
       ONCE per	workflow instance and the parameters are read and evaluated
       when the	validator is created first.

   Argument Parsing
       The Workflow base class already replaces	arguments starting with	a
       dollar sign by the approprate context values. In	addition, argument
       values starting with a template toolkit sequence	[%... are parsed using
       OpenXPKI::Template with the full	workflow context as parameters and the
       given argument as template.

Sub-Classing
   validation
       To implement your own validator you need	use Moose and inherit from
       this class. Please implement your code in a method called _validate,
       starting	with and underscore! If	you dont need the features from	this
       class, you can also subclass directly from Workflow::Validator.

       Validation errors MUST be thrown	using the validation_error method. The
       first argument MUST be a	verbose	description starting with
       I18N_OPENXPKI_UI_, you SHOULD pass a list of the	fields that caused the
       error as	second argument:

	  validation_error ('I18N_OPENXPKI_UI_VALIDATOR_FIELD_HAS_ERRORS',
	      {	invalid_fields => \@fields_with_error }	);

       Where each item in the list is a	hash with the key name and, optional,
       additional infos	on the error. (this is not fully specified and also
       not evaluated on	the UI)

   preset
       The validator pattern is	usually	not bound to the context sensitive and
       expects the values to be	validated as arguments.	As OpenXPKI widely
       uses normalized context key names, you can define a preset list to be
       used instead of arguments set in	the config. Define the sub
       _preset_args:

	 sub _preset_args {
	   return [ qw(cert_profile cert_subject_style)	];
	 }

       If no arguments are set in the validator	definition, the	constructor
       reads the context values	at the given keys and injects them as
       arguments to the	_validate method. The given preset example will	set
       the first two arguments in the same way as the initial example code
       with the	third parameter	remaining undefined. Note: The preset
       arguments are not expanded! You need to pass the	context	keys as	string
       without leading "$" and can not use templates or	static values.

   Logging
       Log event for validation	process	must use facility application and
       should use priorities error and debug. Configuration errors should
       trigger OpenXPKI::Exception and log to workflow/error.

perl v5.24.1			  2017OpenXPKI::Server::Workflow::Validator(3)

Name | SYNOPSIS | Description | Sub-Classing

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=OpenXPKI::Server::Workflow::Validator&sektion=3&manpath=FreeBSD+12.0-RELEASE+and+Ports>

home | help