SDK
SDK Java v2.x
1

# Constructors

# Instantiates a new User object, which is a representation of a Kuzzle user and is linked to a security Profile.

# User(Security, id, content, [meta])

Arguments Type Description
Security Security An instantiated Security object
id string Unique user identifier
content JSON Object User content
meta JSON Object User metadata

Note: this constructor won't make any call to Kuzzle.


# Properties

Property name Type Description get/set
content JSON object Raw user content get
id string Unique profile identifier get
meta JSON object User metadata get

# Return Value

Returns the User object.

# Usage

Copied to clipboard!
JSONObject userContent = new JSONObject()
  // A "profile" field is required to bind a user to an existing profile
  .put("profileIds", new JSONArray().put("admin"))
  // The "local" authentication strategy requires a password
  .put("password", "secret password")
  // You can also set custom fields to your user
  .put("firstname", "John")
  .put("lastname", "Doe");
// Using the KuzzleSecurity factory:
User user = kuzzle.security.user("user ID", userContent);
// Or directly with the constructor:
User user = new User(kuzzle.security, "user ID", userContent);