Layer 7 Access Management

Expand all | Collapse all

Disable SiteMinder Policy using Perl

Jump to Best Answer
  • 1.  Disable SiteMinder Policy using Perl

    Posted 04-11-2016 05:12 PM

    Hi,

    I have created SiteMinder domain and policy (under the same domain) but getting error when trying to disable the policy. I tried adding double quote, single quote but there was no luck. Could you please shed some light on what is causing the issue?

     

    #Creating Connection to Policy Server

    use Netegrity::PolicyMgtAPI;

    $policyapi = Netegrity::PolicyMgtAPI->New();

    if(!defined $policyapi)

    {

    die "\nFATAL: Unable to create Policy Server Connection \n";

    }

    print "Creating Policy Server Connection Session..... \n";

    $mysession = $policyapi->CreateSession("siteminder","password","ipddress");

    if(!defined $mysession)

    {

    die "\nFATAL: Unable to create Session \n";

    }

    #Create a Domain

    print "\tCreating Domain \'raja-shravan-perl-test-domain\'...";

    $domain = $mysession->CreateDomain("raja-shravan-perl-test-domain","raja-shravan-perl-test-domain");

    if(!defined $domain) {

    die "\nFATAL: Unable to create Domain \'raja-shravan-perl-test-domain\'\n";

    }

    # Create a Policy under the raja-shravan-perl-test-domain Domain

    print "\tCreating Policy \'raja-shravan-perl-test-policy\'...";

    $policy = $domain->CreatePolicy("rajashravan-perl-test-policy","raja-shravan-perl-test-policy","1","test");

    if(!defined $policy) {

    die "\nFATAL: Unable to create Policy \'raja-shravan-perl-test-policy\'\n";

    }

     

    #Disable Policy under the raja-perl-test-domain Domain

    print "\tModifying Policy \'raja-perl-test-policy\'...";

    if($policy == 'raja-perl-test-policy') {

    $policy=$policy->IsEnabled(0);

    print "\tPolicy \'raja-perl-test-policy\' has been modified...";

    }

     

    Creating Policy Server Connection Session.....

    Can't call method "IsEnabled" on an undefined value at create-domain2.pl line 17.

            Modifying Policy 'raja-perl-test-policy'...

     

    Thank you,

    Raja Shravan



  • 2.  Re: Disable SiteMinder Policy using Perl
    Best Answer

    Posted 04-12-2016 10:56 AM

    Raja,

     

    You must get the Domain, then get the Policy, then call the CLI Policy Method IsEnabled to toggle the enable/disable flag on the policy.

     

    $domain = $mysession->GetDomain("raja-perl-test-domain");

    $policy = $domain->GetPolicy("raja-perl-test-policy");

    $result = $policy->IsEnabled(1);

     

    Please let me know if you have questions.  If my repsonse answers your question please mark it as the correct answer.