Added support for callable credential validator 

This is an update for #3371.

It provides 
- tests
- usage of a callback instead of a closure