see unit tests for this function--especially for AnonymousUser