Example #1
0
 private void createPolicy() throws Exception {
   Policy policy = new Policy(POLICY_NAME, "", false);
   PolicyManager pm = new PolicyManager(adminToken, SUB_REALM1);
   SubjectTypeManager mgr = pm.getSubjectTypeManager();
   Subject subject = mgr.getSubject("AuthenticatedUsers");
   Map<String, Set<String>> actionValues = new HashMap<String, Set<String>>();
   {
     Set<String> set = new HashSet<String>();
     set.add("allow");
     actionValues.put("GET", set);
   }
   {
     Set<String> set = new HashSet<String>();
     set.add("allow");
     actionValues.put("POST", set);
   }
   policy.addRule(
       new Rule(
           "rule",
           "iPlanetAMWebAgentService",
           "http://www.ReferredResourcesTest.com/1/2",
           actionValues));
   policy.addSubject("subject", subject);
   pm.addPolicy(policy);
 }