[JENKINS-25726] - Fixed the previous implementation, added support of anonymous users

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>