You could copy the code that modActiveDirectory uses and customize it to your system.
The key parts are:
- You need a custom user class to do it, so that MODx can know how to authenticate that user
- You need to add the model path for your custom user class to the ’extension_packages’ setting (see the resolver in the modActiveDirectory script for how)
modActiveDirectory actually is a pretty good starting point/example for this.
http://github.com/splittingred/modActiveDirectory/