refactored and simplified SecurityContext and Authenticator logic
Merge branch 'develop' into result_count