Developing and plugging in custom realms.
simple/
Please refer to webapps->security->file-auth sample
rdbms/
Developing a realm to connect to a relational database.