public function getNickname() {
    if ($this->email != null && $this->auth_domain != null &&
        StringUtil::endsWith($this->email, '@' . $this->auth_domain)) {
      $suffixLen = strlen($this->auth_domain) + 1;
      return substr($this->email, 0, -$suffixLen);
    } else if ($this->federated_identity) {
      return $this->federated_identity;
    } else {
      return $this->email;
    }
  }