Symantec Access Management

 View Only
  • 1.  SDK get realm timeouts

    Posted Feb 05, 2019 11:04 AM

    I am trying to read the realm timeouts using java SDK which looks like below. Appreciate any help, thanks in advance!!

     

    Considering I have an agentapi initialized.

    SmApiConnection apiConnection = new SmApiConnection(agentapi);

    apiConnection.isValidApiConnection()    --> returning true

     

    SmApiSession apiSession = new SmApiSession(apiConnection);

    SmApiConnection smAPIConnection = apiSession.getApiConnection();

    smAPIConnection.isValidApiConnection()    --> returning true

     

    SmPolicyApiImpl policyApi = new SmPolicyApiImpl(apiSession);

    String domainNameString = "";

                                   

    SmRealm smRealm = new SmRealm();

    smRealm.setAgent(agentapi);

    smRealm.setDomain(domainOid);

     

    SmApiResult domainNameObj = policyApi.getDomainObject(domainNameString, domainOid, smRealm);                domainOid à value retreived from agentapi.isProtected call.

    domainNameObj.isSuccess()   -->returning false

                                                   

    SmApiResult apiResult = policyApi.getRealm(targetUrl, smRealm.getDomainName(), smRealm);

    domainNameObj.isSuccess()   -->returning false

    LOGGER.warn("getIdleTimeout value : " +smRealm.getIdleTimeout() );   -->returning 3600

    LOGGER.warn("getMaxTimeout value : " +smRealm.getMaxTimeout() ); -->returning 7200

     

    The returned timeout values (which looks like default values) are not the same I see in SiteMinder Administrative UI.



  • 2.  Re: SDK get realm timeouts

    Posted Feb 07, 2019 10:20 AM

    Here is an example of how I am gathering details on all domains which might help:

     

    public static void listPolicyInfoWithRules(SmApiSession smApi) throws SmApiException {
            Vector<String> domainsVector = new Vector<String>();
            Vector<String> policiesVector = new Vector<String>();
            SmPolicyApi smPolicyApi = new SmPolicyApiImpl(smApi);
            try {
                PrintWriter pw = new PrintWriter(new FileWriter("siteminder_policy_info_rules.txt"));
                smPolicyApi.getGlobalObjectNames("Domains", domainsVector);
                for (String d : domainsVector) {
                    pw.println("Domain: " + d);
                    SmDomain domain = new SmDomain();
                    smPolicyApi.getDomain(d, domain);
                    smPolicyApi.getDomainObjectNames("Policies", domain.getName(), policiesVector);
                    // INFO: System.out.println(policiesVector); // --> [PolicyDetails Policy,
                    // DevProductivity Policy, admin policy]
                    for (String p : policiesVector) {
                        SmPolicy policy = new SmPolicy();
                        smPolicyApi.getPolicy(p, domain.getName(), policy);
                        pw.println("\tPolicy: " + policy.getName());
                        Vector<SmPolicyLink> polLinks = new Vector<SmPolicyLink>();
                        smPolicyApi.getPolicyLinks(policy.getName(), domain.getName(), polLinks);
                        for (SmPolicyLink ruleLink : polLinks) {
                            SmRule rule = new SmRule();
                            SmRealm realm = new SmRealm();
                            SmResponse response = new SmResponse();
                            Vector<SmResponseAttr> responseAttrsVector = new Vector<SmResponseAttr>();
                            smPolicyApi.getRule(ruleLink.getRule().toString(), policy.getName(), domain.getName(), rule);
                            smPolicyApi.getRealm(rule.getRealm().toString(), domain.getName(), realm);
                            smPolicyApi.getResponse(ruleLink.getResponse().toString(), domain.getName(), response);
                            smPolicyApi.getResponseAttrs(response.getName(), domain.getName(), responseAttrsVector);
                            pw.println("\t\tRule: " + rule.getName());
                            pw.println("\t\t\tResource: " + realm.getResourceFilter() + rule.getResource());
                            pw.println("\t\t\tResponse: " + response.getName());
                            for (SmResponseAttr responseAttr : responseAttrsVector) {
                                pw.println("\t\t\t\tValue: " + responseAttr.getValue());
                            }
                        }
                    }
                }
                pw.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }