Previous Topic: About Agents and the Agent API

Next Topic: Single Sign-on and the Agent API

Write a Script against the Agent API

All scripts require certain common basic steps.

To write a script against the Agent API

  1. Reference the Agent API at the beginning of your script:
  2. Use the New() method to create an Agent API object:
    $agentapi=Netegrity::AgentAPI‑>New("agtName","shrdScrt");
    

    Note: Specifying the shared secret in the second argument creates a v4.x agent. Omitting the shared secret creates a v5.x or 6.x agent.

  3. Provide configuration information about the Policy Server. The IP address is required, but you can accept the defaults for other arguments:
    $serverconfig = $agentapi‑>AddServerConfig($ipAddr);
    
  4. Connect to the Policy Server:

Example: Verify the protection on a resource

After you have completed these basic steps, you can perform various agent operations. For example, you can see whether a specified resource is protected by the agent, and if so, you can find out the credentials that are required to access the resource:

$resource = $agentapi‑>GetResource("/companyXYZ/private/");
if($resource‑>IsProtected() == SM_AGENTAPI_YES) {
   print "\nAuthentication Type: ".$resource‑>GetAuthType();
}
else {
   print "The resource is not protected.";
}


Copyright © 2010 CA. All rights reserved. Email CA about this topic