Find Container
Each time an end user triggers the registration process, a new container is provisioned containing cyptographic keys and policy information corresponding to a service. This implies that an integrating application might need to manage multiple containers from either the same or multiple servers.
The HID Approve SDK provides an API to list and filter all registered containers. Identifying the relevant container is generally the starting point for most operations.
Typical Use Case
The mobile application locates a container as follows:
-
Create an instance of the IDevice (DeviceFactory.GetDevice).
-
Define the filter parameter to search for a container (or, by default, list all):
-
CONTAINER_NAME – friendly name of container
-
CONTAINER_URL – server URL
-
CONTAINER_USERID – user identifier
-
-
Get the instance of the IContainer (IDevice.FindContainers).
// We assume that you have already provisioned one or several containers.
// findContainers will provide you the full list of containers registered, sorted by the creation date.
IList<Parameter> filter = new List<Parameter>();
IList<IContainer> containers = await device.FindContainers(filter);
foreach (var container in containers)
{
Debug.WriteLine("Container found - Name: " + container.Name);
Debug.WriteLine("Container found - UserId : " + container.UserId);
myContainerName = container.Name;
myuserId = container.UserId;
}
//Alternatively, you can search a container through a filter for example, the user id and the name
filter.Add(new Parameter(Constants.CONTAINER_NAME, myContainerName));
filter.Add(new Parameter(Constants.CONTAINER_USERID, myuserId));
IList<IContainer> FilteredContainers = await device.FindContainers(filter);
foreach (var container in FilteredContainers)
{
Debug.WriteLine("Container found - Name: " + container.Name);
Debug.WriteLine("Container found - UserId : " + container.UserId);
}