Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
OpenXPKI::Server::Workflow::Validator(3) User Contributed Perl Documentation OpenXPKI::Server::Workflow::Validator(3)


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

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

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.

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.

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:

       { 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)

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.

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.
2022-05-14 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.