serialize

String serialize()

Converts an identity object to an identity string.

You can set the identity string in an attribute object and pass the same in the login and getInfo APIs.

Generating an identity string

The following are the steps in generating an identity string:

1.Create an identity class object. In its attribute parameter, specify the user name and customer information, in the form of key-value pairs, by using the following attributes of the LicensingConstant class:

SNTL_ATTR_IDENTITY_CUSTOMER_ID

SNTL_ATTR_IDENTITY_USERNAME

2.Call the serialize method of the Identity class.

3.Pass the output of this API (a serialized identity string) in the getInfo scope or in the login API.

/* Generate identity string */
String customer = "SampleCustomer";
String user = "SampleUser";
Attribute identityAttributes = new Attribute();
identityAttributes.set(LicensingConstants.SNTL_ATTR_IDENTITY_CUSTOMER_ID, customer);
identityAttributes.set(LicensingConstants.SNTL_ATTR_IDENTITY_USERNAME, user);

String identity = new Identity(appContext, identityAttributes).serialize();

Returns

This API returns a serialized string.

Exception Handling

If unsuccessful, throws LicensingException.