Authentication support for realms
refactoring of repositories