In order to understand how Flask-principal works, you will need to read and understand :
http://discorporate.us/projects/Blinker/docs/tip/signals.html
http://docs.python.org/2/library/collections.html#collections.namedtuple
http://www.doughellmann.com/PyMOTW/contextlib/
http://stackoverflow.com/questions/739654/understanding-python-decorators
You can then look at the example : https://github.com/mickey06/Flask-principal-example/blob/master/FPrincipals.py
and the extension's source code.
https://github.com/mattupstate/flask-principal/blob/master/flask_principal/__init__.py
This example was inspired by :
Flaskr
http://stackoverflow.com/questions/7050137/flask-principal-tutorial-auth-authr
and
http://terse-words.blogspot.com/2011/06/flask-extensions-for-authorization-with.html