Directory Factory

The Directory factory is built with Directory credentials and can make both a Directory Client and a Service Client.

Making a Directory Factory

A Directory factory can be created using the Factory factory. It utilizes Directory specific credentials to identify itself, encrypt and sign the request data, and verify the signature and decrypt encrypted response data. All of the information can be located on the Keys tab of the Directory’s page in the Admin Center.

The data is as follows:

  • Directory ID
  • Private Key


var privateKey = File.ReadAllText("directory_private_key.pem'");
var directoryId = "9e0310ba-d9d6-11e6-942a-b4750ee43a10";
var directoryFactory = factoryFactory.MakeDirectoryFactory(directoryId, privateKey);
File file = new File("directory_private_key.pem");
Scanner sc = new Scanner(privateKeyFile);
StringBuilder sb = new StringBuilder();
while (sc.hasNextLine()) {
String privateKey = sb.toString();
String directoryId = "9e0310ba-d9d6-11e6-942a-b4750ee43a10";
DirectoryFactory directoryFactory = factoryFactory.makeDirectoryFactory(directoryId, privateKey);
# Python does not have a FactoryFactory or FactoryFactoryBuilder
with open('directory_private_key.pem') as pem:
    private_key =
directory_id = "9ecc57e0-fb0f-4971-ba12-399b630158b0"
directory_factory = DirectoryFactory(directory_id, private_key)

Making A Directory Client

The Directory Client can be made without credentials as they are already provided to the factory:

var directoryClient = directoryFactory.MakeDirectoryClient();
DirectoryClient directoryClient = directoryFactory.makeDirectoryClient();
directory_client = directory_factory.make_directory_client()

Making A Service Client

The Service Client can be made by providing a Service ID for a Service belonging to the Directory as follows:

var serviceId = "b1d05c28-0b18-41e4-94a0-853758eeefc8";
var serviceClient = directoryFactory.MakeServiceClient(serviceId);
String serviceId = "b1d05c28-0b18-41e4-94a0-853758eeefc8";
ServiceClient serviceClient = directoryFactory.makeServiceClient(serviceId);
service_id = "b1d05c28-0b18-41e4-94a0-853758eeefc8"
service_client = directory_factory.make_service_client(service_id)

User Contributed

LaunchKey links to user contributed code as a resource to its community. LaunchKey does not in any way guarantee or warrant the quality and security of these code bases. User contributed code is supported by the creators. If you do find a link from the site to user contributed code that is malicious or inappropriate in any way, please report that link to LaunchKey immediately and we will investigate the claim. Submit any issue to LaunchKey support at ×