Symantec Access Management

  • 1.  SiteMinder Java API Update Method Problems

    Broadcom Employee
    Posted Sep 06, 2016 03:56 PM

    Hi all,

    I am developing a policy management application with the Java SDK framework provided by CA. Please take a look at the method I posted below. I am calling this method from a Jbutton in a different class. I wonder if someone familiar with the API's can look at this and give input.  Please excuse the formatting, when I copied from Eclipse it seemed to lose my indentations.

     

    I am storing the ACO properties in a hash map and displaying them to a Jtable (not seen in the code below) This code below is working, but it is not the way I want it to work. I am making updates to the ACO parameters directly from the JTable which uses an abstract table model I created to get and set the AcoUpdateMap(). The problem is when I try to use the setAgentConfigProperties method and pass in the acoUpdates hash map that was edited by the user in the JTable, it does not take unless I first call the:

    policyapi.deleteAgentConfig

    then call the: setAgentConfigProperties()

    and finally call the: policyapi.addAgentConfigProperties.

    The CA code states that you can call the setAgentConfigProperty on an SmProperty property object and it will update the value of an existing one. I tried to update each in a for loop as well and that method did nothing. This causes issues for me because it is constantly creating a new OID value on the delete and recreate of the object and I would like that OID value to stay the same after ACO parameter updates.

    Any help on this would be greatly appreciated. 

    The CA SDK documentation states: 

     voidsetAgentConfigProperties(SmProperty[] properties) 
              Creates a private hashtable containing Agent Configuration object parameters from passed SmProperty objects.
     voidsetAgentConfigProperty(SmProperty property) 
              Adds a new agent configuration parameter or updates value of an existing one.

     

     

     

    MY CODE START

    ================

     

    public void doModificationUpdateACO() throws SmApiException{

    SmApiResult result = new SmApiResult();

    SmPolicyApi policyapi = new SmPolicyApiImpl(session);

    SmAgentConfig acoRetrieve = new SmAgentConfig(ACO_TO_RETRIEVE);

    result = policyapi.getAgentConfig(ACO_TO_RETRIEVE, acoRetrieve);

    boolean getacosuccess = result.isSuccess();

    System.out.println("Agent successfully retrieved in update method: " + getacosuccess);

    String acoOldOid = acoRetrieve.getOid().toString();

     

    SmProperty acoUpdates[] = new SmProperty[ getAcoUpdateMap().size() ];

     

     

    System.out.println("ACO map size is" + getAcoUpdateMap().size());

     

    int i = 0;

    for (Map.Entry<String, String> entry : getAcoUpdateMap().entrySet()){

     

    acoUpdates[i] = new SmProperty(entry.getKey(), entry.getValue());

     

      i++;   

    }

     

    result = policyapi.deleteAgentConfig(ACO_TO_RETRIEVE);

    boolean delACOsucc = result.isSuccess();

    System.out.println("ACO delete success: " + delACOsucc);

    acoRetrieve.setAgentConfigProperties(acoUpdates);

     

    result = policyapi.addAgentConfig(acoRetrieve);

    boolean addACOsucc = result.isSuccess();

    acoRetrieve.setOid(acoOldOid);

     

    System.out.println("ACO add success: " + addACOsucc + "OID: " + acoRetrieve.getOid().toString());

     

    }

     

     

     

    Thank you!

    Adam 



  • 2.  Re: SiteMinder Java API Update Method Problems
    Best Answer

    Broadcom Employee
    Posted Sep 06, 2016 09:22 PM

    Hi,

     

    Please call modifyAgentConfig() after calling setAgentConfigProperties().

    See an SDK sample javapolicyapi/PolicyApiModifySample.java, a method updateAgentConfig().

    Reference: Agent Configuration Object Methods - CA Single Sign-On - 12.52 SP1 - CA Technologies Documentation 

     

    I hope this would help.

     

    Regards,

    Koichi



  • 3.  Re: SiteMinder Java API Update Method Problems

    Broadcom Employee
    Posted Sep 06, 2016 10:15 PM

    Excellent Koichi! 

     

    Thank you for the quick response, this worked exactly as I wanted it to. I'm not quite sure how I missed that, I was looking in the SmAgentConfig class so much I completely neglected to look in the PolicyApi portion of the JavaDoc.

     

    Maybe you know this as well: When I retrieve the ACO parameters it only brings back the currently active ones that are not with a # or disabled on the AdminUI. 

    e.g. (#AgentName is not returned but AgentName would be) - Is there a way to return all of the ACO parameters including the #'ed out ones with the API so the end user could enable and disable from the Java api?

     

    Very appreciative of your support,

     

    Adam



  • 4.  Re: SiteMinder Java API Update Method Problems

    Broadcom Employee
    Posted Sep 06, 2016 10:44 PM

    Hi,

     

    The method modifyAgentConfig() is documented in JavaDoc Class SmPolicyApiImpl.

     

    Regarding the commented property problem, this seems a defect fixed in 12.52 SP1 CR01.

    Defects Fixed in 12.52 SP1 CR01 - CA Single Sign-On - 12.52 SP1 - CA Technologies Documentation 

     

    Commented ACO Properties Get Deleted (74943)

    Symptom:

    Commented ACO properties with hash # symbol get deleted using modifyAgentConfig API.

    Solution:

    This issue is fixed.

     

    Regards,

    Koichi



  • 5.  Re: SiteMinder Java API Update Method Problems

    Broadcom Employee
    Posted Sep 07, 2016 10:16 AM

    Koichi,


    I still am not sure if the issue is fixed completely regarding the Commented ACO Properties Get Deleted.

    The problem still seems to be present when calling the method: 

     

    SmProperty acoConfigs[] = new SmProperty[ propNumber ];

    acoRetrieve.getAgentConfigProperties(acoConfigs);

     

     

    Still does not return the properties that are commented to the SmProperty array. I did notice that when calling the modifyAgentConfig() method on an EXISTING ACO object it does not remove the # properties, but this does not help me when I am attempting to copy the properties from an existing ACO and create a new ACO based on those properties. My reasoning for doing this is for migrating an Object between environments as it does not seem the SmExport() or SmImport() classes support anything more granular then Domain level migrations.

     

    Any thoughts for me on this one?

     

    Thank you again,

     

    Adam



  • 6.  Re: SiteMinder Java API Update Method Problems

    Broadcom Employee
    Posted Sep 08, 2016 02:10 AM

    Hi,

     

    Regarding your observation below, I think this needs clarification - if it’s spec or defect. You may open a support case.

    acoRetrieve.getAgentConfigProperties(acoConfigs);

     

     

    Still does not return the properties that are commented to the SmProperty array.

     

    And, regarding your migration, I wonder if it would be possible to preserve the original ACO_TO_RETRIEVE so that existing Commented ACO Properties will remain. In this case, you would:

    • copy the value of only modified SmProperty entry by comparing the value between the original ACO_TO_RETRIEVE and your getAcoUpdateMap(),
    • add any SmProperty which was newly created in getAcoUpdateMap(),
    • remove any SmProperty which was deleted in getAcoUpdateMap().

     

    I hope this would help.

     

    Regards,

    Koichi



  • 7.  Re: SiteMinder Java API Update Method Problems

    Broadcom Employee
    Posted Sep 08, 2016 09:18 AM

    Hi Koichi,

     

    Thank you for the feedback, here is what I am seeing.

     

    Admin creates an ACO on the AdminUI from one of the Defaults say Apache. This sets up all the ACO parameters properly about 162 worth including ones that are commented out.

     

    From the SDK - if I call just the modify method on the existing ACO object that Admin created on AdminUI

    result = policyapi.modifyAgentConfig(getAcoToMigrate());

     

    This does not affect the #'ed out parameters. The problems lies when I am doing the migration to the other policy store. That object does not exist on the second policy store so I can't call the modify method on the object. I need to first call the add method like this: So you see first I do try to call just modify on the object, but if the result of that is not successful, I call the add method and then the modify. Anytime the add method is called, it creates a new OID value, and only sets the ACO parameters that are not commented out. The setOID method does not seem to do anything.

     

    getAcoToMigrate().setAgentConfigProperties(acoUpdates);

    result = policyapi.modifyAgentConfig(getAcoToMigrate());

    boolean modACOsucc = result.isSuccess();

     

    System.out.println("ACO add success: " + modACOsucc + "OID: " + getAcoToMigrate().getOid().toString());

    if (modACOsucc == false){

       getAcoToMigrate().setOid(acoToMigrate.getOid());

       result = policyapi.addAgentConfig(getAcoToMigrate());

       boolean addACOsucc = result.isSuccess();

       System.out.println("Could not modify existing ACO, creating a new one." + addACOsucc);

    //getAcoToMigrate().setOid(acoOldOid);

       result = policyapi.modifyAgentConfig(getAcoToMigrate());

       boolean modOnAddACO = result.isSuccess();

       System.out.println("Added ACO and modified accordingly: " + modOnAddACO);

    }



  • 8.  Re: SiteMinder Java API Update Method Problems

    Broadcom Employee
    Posted Sep 08, 2016 08:56 PM

    Hi,

     

    Sorry that I could not understand your requirement well, but please let me repeat that: I suppose your problem is caused by what you mentioned below. 

    acoRetrieve.getAgentConfigProperties(acoConfigs);

     

     

    Still does not return the properties that are commented to the SmProperty array.

    Regards,

    Koichi