Custom authentication provider

We have to implement a custom authentication provider, so for that which package should be taken in use and what are the classes to be extended?

Gone through the link:-

The concern is how we can configure to make it done.

Everything needed is explained in Once implemented, you configure it like you do any other authentication provider provided with the framework. So not sure where you struggle. Please provide detailed information on what you did and what is not clear.