Mango can be extended by the use of plugins and custom tags.
Creating a plugin
Plugin Best Practices
Custom Authentication