Session validators provide various protection against session hijacking. Please view this one first.
That is pretty easy.
return [
'htsession' => [
'options' => [
'validators' => [
// validators list goes here
]
]
]
];
Zend Framework 2 comes with 2 session validators:
To create a custom role providers, you first need to create a class that implements the Zend\Session\Validator\ValidatorInterface interface.
Then, you need to add it to the session validator plugin manager this way:
return [
'htsession' => [
'validators' => [
'factories' => [
'Application\Session\Validator\MySessionValidator' => `Application\Factory\MySessionValidatorFactory`
]
]
]
];
Now, your session validator is only added to the session validator plugin manager. To use this:
return [
'htsession' => [
'options' => [
'validators' => [
'Application\Session\Validator\MySessionValidator'
]
]
]
];