If you search the web for "Linux PAM" you'll find the
Pluggable Authentication Modules for Linux at kernel.org including pointers to other docs and the mailinglist. Start by setting up PAM, read /usr/share/doc/pam-*, the mailinglist archives and modules' source code.