All scripts require certain common basic steps.
To write a script against the Agent API
$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.
$serverconfig = $agentapi‑>AddServerConfig($ipAddr);
$agentapi‑>Connect();
$agentapi‑>Connect("../../../../Program Files/Netegrity/webagent/config/smhost.conf");
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 |