/*
decrypt user info
@return json string
172865
private function decrypt($data)
	{
		$key = md5($this->_config['serverSecret']);
	    $x = 0;
	    $data = base64_decode($data);
	    $len = strlen($data);
	    $l = strlen($key);
	    for ($i = 0; $i < $len; $i++)
	    {
	        if ($x == $l) 
	        {
	            $x = 0;
	        }
	        $char .= substr($key, $x, 1);
	        $x++;
	    }
	    for ($i = 0; $i < $len; $i++)
	    {
	        if (ord(substr($data, $i, 1)) < ord(substr($char, $i, 1)))
	        {
	            $str .= chr((ord(substr($data, $i, 1)) + 256) - ord(substr($char, $i, 1)));
	        }
	        else
	        {
	            $str .= chr(ord(substr($data, $i, 1)) - ord(substr($char, $i, 1)));
	        }
	    }
	    return $str;
	}
900245
public function decrypt(string $data)
    {
        if (!$this->password)
        {
            return JSON::decode($data);
        }

        $decrypt = $this->security()
            ->decrypt($data);

        return JSON::decode($decrypt);
    }
947909
public function acquireUserInfo()
    {
        // Request the userinfo
        $client = new Client(); //GuzzleHttp\Client

        $this->buildHttpHeader();
        $endpoint = $this->userinfo_endpoint;

        try {
            $response = $client->request('GET', $endpoint, [
                'header' => $this->headers,
                'curl' => $this->setGetCurlopts(),
            ]);

            // Get the token and type from the response
            // $this->parseTokenResponse($response);
            return json_decode($response->getBody(), true);

        } catch (\GuzzleException $e) {

            return false;
        }
    }
770278
public function getJson()
    {
        $dirty = $this->getDirty();
        if (count($dirty)) {
            $this->internal_original_value = $this->__toString();
        }

        return $this->internal_original_value;
    }
8487
static public function decryptJson($ciphertextFileName, Config $config = null) {
        $content = self::decrypt($ciphertextFileName, $config);
        $data = json_decode($content, JSON_OBJECT_AS_ARRAY);
        Util::isArrayOrFail("Encrypted secrets", $data);
        return $data;
    }
68842
public function getPayloadJSON()
    {
        $data = is_string($this->data) ? mb_convert_encoding($this->data, 'UTF-8') : $this->data;
        return json_encode($data);
    }
327202
function GetDetailedUsersArray()
  {
      $users_array = array();
      $result = $this->GetNextUserArray(TRUE);
      if (isset($result['user'])) {
          $users_array[$result['user']] = $result;
      }
      do {
          if ($result = $this->GetNextUserArray()) {
              if (isset($result['user'])) {
                  $users_array[$result['user']] = $result;
              }
          }
      } while (FALSE !== $result);
      return $users_array;
  }
1160410
protected function _getJson()
    {
        if ($this->_json) {
            return $this->_json;
        }

        return $this->_json = json_decode($this->_getBody(), true);
    }
875857
protected function getEncryptedEntity()
    {
        return utf8_encode(Yii::$app->getSecurity()->encryptByKey(Json::encode([
            'entity' => $this->entity,
            'entityId' => $this->entityId,
            'relatedTo' => $this->relatedTo,
        ]), $this->getModule()->id));
    }
1230563
function toJSON() {
      const model = this.toObject()
      delete model.password
      delete model.salt

      // Return the modified user object.
      return utils.remove_null_undefined(model)
    }
108155
public function json() {
			$json = parent::json();

			$is_contact_visible = $this->fs->is_page_visible( 'contact' );
			$is_support_visible = $this->fs->is_page_visible( 'support' );

			$json['theme_title'] = $this->fs->get_plugin_name();

			if ( $is_contact_visible && $is_support_visible ) {
				$json['theme_title'] .= ' ' . $this->fs->get_text_inline( 'Support', 'support' );
			}

			if ( $is_contact_visible ) {
				$json['contact'] = array(
					'label' => $this->fs->get_text_inline( 'Contact Us', 'contact-us' ),
					'url'   => $this->fs->contact_url(),
				);
			}

			if ( $is_support_visible ) {
				$json['support'] = array(
					'label' => $this->fs->get_text_inline( 'Support Forum', 'support-forum' ),
					'url'   => $this->fs->get_support_forum_url()
				);
			}

			return $json;
		}
899641
@Override
    public String getUserPrincipals() {
        if (userPrincipals == null) {
            return null;
        }

        JSONObject jsonObj = new JSONObject(userPrincipals);

        return jsonObj.toString();
    }
299015
function userJSON(user, options) {
	return {
		FullName: user.fullname,
		UserName: user.username,
		Location: api.join(options.usersRoot, user.username),
		Email: user.email,
		EmailConfirmed: emailConfirmed(user),
		HasPassword: true,
		OAuth: user.oauth || undefined,
		LastLoginTimestamp: user.login_timestamp ? user.login_timestamp.getTime() : 0,
		DiskUsageTimestamp: user.disk_usage_timestamp ? user.disk_usage_timestamp.getTime() : 0,
		DiskUsage: user.disk_usage || 0 ,
		jwt: user.jwt
	};
}
496945
public function getUser()
    {

        // destroy previous content
        $this->destroyUserData();

        if ($this->user === false) {

            // get user

            $url = 'http://ulogin.ru/token.php?token=' . $this->getToken() . '&host=' . (new Request())->getHttpHost();
            $content = file_get_contents($url);
            $this->user = json_decode($content, true);

            // if use has error , destroy user data
            if ($this->destroyUserData() === true) {
                $this->logout();
            }
        }

        return $this->user;
    }
794694
public function adm_get_safe_user_data() {
		if (!$this->store_is_logged_in())
			return [AdminStoreError::USER_NOT_LOGGED_IN];
		$data = $this->user_data;
		foreach (['upass', 'usalt', 'sid', 'token', 'expire'] as $key)
			unset($data[$key]);
		return [0, $data];
	}
433832
public function loadUserFromToken()
    {
        $token = $this->httpSession()->get($this->getTokenName());
        if (!$token) {
            return false;
        }

        return $this->decryptUserData($token);
    }
28321
public function loadUserFromToken()
    {
        $token = $this->httpCookie()->get($this->getTokenName());
        if (!$token) {
            return false;
        }

        return $this->decryptUserData($token);
    }