Agents

Introduction

In a Citrix environment, there is one Trust1Connector core service, running on the main machine, and one or more agents, one for each user session, which registers itself on the core service. The core service then acts as a proxy, relaying requests to specific agents as needed.

When running in Citrix mode (citrix == true in the core information response), the core Trust1Connector service will not allow access to any endpoint other than the agent list.

In order to communicate with an agent, we must determine which agent we want to use (this is up to the application), and then re-initialize a client library with the agentPort of our target agent. This will redirect all requests to this agent.

Flow

Citrix Redirect

Retrieving agent list

The agent list is managed by the core Trust1Connector service, and is the only endpoint that is accessible on this instance of Trust1Connector.

To retrieve the list, we initialize a GCLClient instance without agent port, which will communicate directly with the core T1C.

LibConfig conf = new LibConfig();

/*Instantiate client*/
client = new T1cClient(conf);

Once this is done, we can retrieve the agent list:

// result contains the full list of agents
List<GclAgent> agents = client.getCore().getAgents();

The response will contains a list of available agents:

com.t1t.t1c.core.GclAgent

Name Description Example Value Type
challenge Internal challenge to identify client "2cd89c9f-d1e5-4648-a850-6ddf9313d052" java.lang.String
hostname The agent hostname "macbook" java.lang.String
lastUpdate The time of the last update "2018-03-12T14:09:41.521521" java.lang.String
metadata Optional metadata N/A java.util.map<String, String
port The agent port 57043 java.lang.Integer
username The username associated with the agent "johndoe" java.lang.String

It contains an array of all the agents known to the system. It is also possible to filter the list of results, by passing in a filter object:

List<GclAgent> agents = client.getCore().getAgents(Collections.singletonMap("username", "johndoe"));

The filters will be matched to the username and metadata properties of the agents, and only matching agents will be returned.

Once the list of agents is retrieved, the application selects the agent to use from the list. For this agent, we initialize a new client that will communicate only with the selected client by passing in the port in our config.

Initialize agent client

Once we have determined the agent port to use, we can initialize the agent client as follows:

GclAgent chosenAgent = agents.get(choice);
conf.setAgentPort(chosenAgent.getPort());


// client returned is initialized for use with the selected agent's port
// should be used for all subsequent calls
client = new T1cClient(conf);

The new client will now only communicate with the selected agent, and should be used for all subsequent calls.

results matching ""

    No results matching ""