Zetect Connector Guide Back to zetect.inSwitch portal ⇄

Understanding Agents and Connectors

Zetect never calls your target system directly. It puts a request on a message broker, the agent on your network picks it up, hands it to the connector with the matching name, and publishes the connector's result back to Zetect. This page explains that round trip, so you know exactly what your connector receives and what it must send back.

How it works

When the agent starts, it does three things in order:

  1. It registers with your Zetect tenant using the agent API key and tenant identifier. Zetect replies with the broker address and the names of the agent's queues. The agent caches this reply in /opt/cyiam-agent/.agent-state and reuses it on later starts.
  2. It loads connectors. It scans the connectors folder once, opens each .jar file in its own class loader, and uses the Java ServiceLoader to find classes that implement io.cyiam.connector.api.Connector. Each connector is registered under the name returned by connectorName().
  3. It starts listening on its inbound queues and sends a heartbeat to Zetect.

The agent only makes outbound connections, to Zetect over HTTPS and to the broker over AMQP. It opens no inbound port.

Each request then follows the same path:

  1. Something in Zetect needs work done on the target, for example an administrator starts an aggregation, an approver approves an access request, or a certification reviewer revokes access.
  2. Zetect builds a JSON request with an action, the application's connectorName, its connectionInfo (the connection settings, with secrets decrypted) and the data for that action. It publishes the request to your tenant's inbound queue.
  3. The agent reads the request, checks that the action is one it accepts, and discards duplicates it has already seen.
  4. The agent looks up the connector registered under connectorName and calls one of its two methods, depending on the action.
  5. Your connector does the work on the target system and calls publisher.publish(...) with a result.
  6. The agent serialises the result to JSON and publishes it to Zetect's outbound routing key. Zetect matches the result to the original request and updates the account, the access request or the aggregation run.

Message transport

Requests and results travel over RabbitMQ on a topic exchange named cyiam.agent. Each tenant has its own inbound queues, so one tenant's requests never reach another tenant's agent. The agent learns the queue names and routing keys when it registers; you never configure them in a connector.

ChannelDirectionQueue or routing keyCarries
ProvisioningZetect → agentQueue agent.<tenantId>.prov.inboundAggregation (SYNC_USER, SYNC_GROUP) and every provisioning action, for applications and privileged access assets.
ImportZetect → agentQueue agent.<tenantId>.import.inboundIDENTITY_SYNC requests from identity sources.
Provisioning resultsAgent → ZetectRouting key prov.outbound.<tenantId>Results of everything received on the provisioning queue.
Import resultsAgent → ZetectRouting key import.outbound.<tenantId>Results of IDENTITY_SYNC.

The agent also listens on a third queue for sign-in and password-reset requests for directory-based authentication. Those are handled by the agent itself and never reach a connector.

Zetect checks the tenant in the routing key against the tenant that sent the request. A result published on another tenant's key is rejected.

How requests reach a connector

The agent routes on two fields of the request.

FieldEffect
connectorNameSelects the connector. It must match connectorName() exactly, including case. If no connector has that name, the agent publishes a failure result with the message No connector registered for: <name>. If the field is missing, the message is Missing connectorName in command.
actionSelects the method. CREATE_ACCOUNT, UPDATE_ACCOUNT, ADD_TO_GROUP, REMOVE_FROM_GROUP, DELETE_ACCOUNT, SUSPEND_ACCOUNT, RESTORE_ACCOUNT and RESET_PASSWORD go to handleProvisioning() and expect a ProvisioningResult. Every other accepted action, including SYNC_USER, SYNC_GROUP and IDENTITY_SYNC, goes to handle() and expects a ConnectorResult.

Zetect only ever sends generic actions. It asks to suspend an account, not to set a particular flag. Your connector decides how each action maps onto the target. Where the target has no disabled state, for example, the connector may implement SUSPEND_ACCOUNT by deleting the account and RESTORE_ACCOUNT by re-creating it. That fallback belongs in the connector, never in Zetect.

For the full list of request types, see Connector Reference.

Results

  • Publish exactly one result per request, on success and on failure. The one exception is a chunked aggregation, where you publish one result per chunk. See Publishing Results.
  • If your method throws, the agent catches the exception and publishes a failure result for you, with the exception's class name and message. Don't rely on this; publish your own failure with a clear message.
  • If your connector doesn't support an action, return ConnectorResult.notSupported(cmd) or ProvisioningResult.notSupported(cmd). Zetect records the failure as actionNotSupported: <action>.
  • Results never include connectionInfo, because it holds credentials.

Example

An approver approves a request for the Finance Approvers role in an in-house application whose connector is named Helpdesk. The requester has no account there yet.

  1. Zetect sends ADD_TO_GROUP with connectorName set to Helpdesk, an empty subject.nativeAccountIdentifier, the account attributes, a generated initial password and one entry in entitlements.
  2. The agent logs Dispatching id=pr-7c1e… action=ADD_TO_GROUP to connector 'Helpdesk' and calls handleProvisioning().
  3. The connector sees there is no account, creates mpatel with the password, adds it to the role, and publishes ProvisioningResult.success(cmd, "mpatel", "Maya Patel").
  4. Zetect marks the access request as provisioned, links the new account to the requester and records the role membership.

Limits and defaults

ItemBehaviour
Connector loadingOnly at agent startup. Adding, replacing or removing a JAR takes effect after you restart the agent.
Duplicate namesIf two JARs register the same connector name, the one loaded last wins. Folder order isn't guaranteed, so keep one JAR per connector.
ConcurrencyThe agent runs up to 10 requests at a time on a pool of worker threads, and can call the same connector instance from several threads at once. Keep your connector thread-safe and avoid shared mutable state.
Duplicate requestsThe agent remembers each requestId (or runId) for 5 minutes and discards a redelivered copy without calling the connector.
Accepted actionsProvisioning queue: SYNC_USER, SYNC_GROUP, the eight provisioning actions listed above, and the legacy actions CREATE_USER, UPDATE_USER, DISABLE_USER, ENABLE_USER and DELETE_USER. Import queue: IDENTITY_SYNC only. Anything else is logged and discarded.
Requests not passed to connectorsZetect also sends Test Connection, attribute-discovery and self-service password-change requests. The current agent doesn't accept those actions, so they never reach a connector.