A good PAM example?

I know there is a SAML plugin to use so that Elgg can act as a SAML SP and authenticate against a SAML IP.

However, I'm wondering if someone has a good example of a PAM usage where Elgg simply authenticates against an existing database, or uses cookies already set from another app in the same domain?  SAML can do what we need, but I'd prefer to just have a fast and direct way to read into an existing user table from a database.  Elgg allows Pluggable Authentication Modules, but there's very little documentation and few examples.