It seems like isAnonymous() should return "true" if getUserPrincipal() is "null".