Previous Topic: SAML 1.x

Next Topic: SAML 2.0

SAML 1.x Pseudo-code Example

The pseudo-code in this section illustrates the following operations:

  1. Initialize the API.
  2. Add an affiliate domain.
  3. Add a user directory to an affiliate domain.
  4. Create an affiliate in an affiliate domain.
  5. Add users to an affiliate.
  6. Add an attribute to an affiliate.
  7. Get an existing affiliate domain.
  8. Get all the affiliates in an affiliate domain.
  9. Get all the attributes in an affiliate.
  10. Remove an affiliate domain.

Note: Comments using <> notation represent code omitted for ease of understanding. Return code checking is omitted for ease of understanding.

# 1. Initialize the API
use Netegrity::PolicyMgtAPI;
$policyapi = Netegrity::PolicyMgtAPI‑>New();
$session = $policyapi‑>CreateSession("adminid", "adminpwd");

# 2. Add an affiliate domain
$affdomain = $session‑>CreateAffDomain("name", "description");

# 3. Add a previously obtained user directory to the affiliate domain
# <Obtain $userdir via $session‑>GetAllUserDirs>
$affdomain‑>AddUserDir($userdir);

# 4. Create an affiliate in the affiliate domain
$affiliate = $affdomain‑>CreateAffiliate("affname", "password",
                                          http://authurl, 60, 30);

# 5. Add users from a previously obtained user table to the affiliate
# <Obtain $user via $userdir‑>GetContents>
$affdomain‑>AddUser($user);

# 6. Add an attribute for the affiliate
$affdomain‑>AddAttribute(1, "staticAttrName=StaticAttrValue");

# 7. Get an existing affiliate domain
$affiliate = $affdomain‑>GetAffiliate("affname");

# 8. Get all the affiliates in an affiliate domain
@affiliates = $affdomain‑>GetAllAffiliate();

# 9. Get all the attributes in an affiliate
@affiliateAttrs = $affiliate‑>GetAllAttributes();

# 10. Remove an affiliate domain
$session‑>DeleteAffDomain($affiliate);


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