Suppose you are an administrator for the domain engineering. You want to create the realm documentation in that domain. Using the Policy Server User Interface, you might take the following steps:
You are accepting all other defaults for the realm (including resource protection, which is enabled by default).
If you write a script to perform the same operation, it might look like this:
#Initialize the Policy Management API
use Netegrity::PolicyMgtAPI;
$policyapi = Netegrity::PolicyMgtAPI‑>New();
print "Step 1. Log in the admin and create an API session.\n";
$session = $policyapi‑>CreateSession("adminid", "adminpwd");
print "Step 2. Select the domain for the new realm.\n";
$domain=$session‑>GetDomain("engineering");
#Get the realm’s agent and authorization scheme info.\n";
$agent=$session‑>GetAgent("agent1");
$authscheme=$session‑>GetAuthScheme("Basic");
print "Step 3. Create and configure the realm.\n";
$realm=$domain‑>CreateRealm("documentation",
$agent,
$authscheme,
"Source files for manuals",
"/mysite/docs/*" );
print "Step 4. Confirm the creation of the realm.\n";
if ($realm == undef) {
print "Realm creation failed.\n";
}
else {
print "Realm creation succeeded.\n";
}
Note: Generally, policy store object names are case-sensitive. In the above example, the Basic authentication scheme and the engineering domain are case-sensitive. Further, agent names are always written to the policy store in lowercase. Existing agents must be referenced in lowercase in your scripts.
| Copyright © 2011 CA. All rights reserved. | Email CA Technologies about this topic |