Develop a Custom search plugin

Hi,
I'm wanting to create a custom plugin. The purpose is to make a rest call to an external service to apply access control polices to search requests. Is there any sample code or an article that would assist?
Appreciated