Ejemplo n.º 1
0
 /** Sets up policy and creates users required by the policy */
 @Parameters({"policyIdx", "resourcePIdx", "resourceNPIdx", "resourceCaseIdx"})
 @BeforeClass(
     groups = {
       "ldapv3",
       "ldapv3_sec",
       "s1ds",
       "s1ds_sec",
       "ad",
       "ad_sec",
       "amsdk",
       "amsdk_sec",
       "jdbc",
       "jdbc_sec"
     })
 public void setup(
     String policyIdx, String resourcePIdx, String resourceNPIdx, String resourceCaseIdx)
     throws Exception {
   Object[] params = {policyIdx, resourcePIdx, resourceNPIdx, resourceCaseIdx};
   entering("setup", params);
   admintoken = getToken(adminUser, adminPassword, basedn);
   logoutURL = protocol + ":" + "//" + host + ":" + port + uri + "/UI/Logout";
   strAgentType = rbg.getString(strGblRB + ".agentType");
   log(Level.FINEST, "setup", "Agent type - " + strAgentType);
   strScriptURL = rbg.getString(strGblRB + ".headerEvalScriptName");
   if (strAgentType.contains("J2EE") || strAgentType.contains("WEBLOGIC")) {
     String strHeaderFetchMode = rbg.getString(strGblRB + ".headerFetchMode");
     strScriptURL = strScriptURL.substring(0, strScriptURL.length() - 1);
     strScriptURL = strScriptURL + "fetch_mode=" + strHeaderFetchMode;
   }
   log(Level.FINEST, "setup", "Header script URL: " + strScriptURL);
   url = new URL(strScriptURL);
   int resPIdx = new Integer(resourcePIdx).intValue();
   int resNPIdx = new Integer(resourceNPIdx).intValue();
   int resCaseIdx = new Integer(resourceCaseIdx).intValue();
   resourceProtected = rbg.getString(strGblRB + ".resource" + resPIdx);
   resourceNotProtected = rbg.getString(strGblRB + ".resource" + resNPIdx);
   resourceCase = rbg.getString(strGblRB + ".resource" + resCaseIdx);
   log(Level.FINEST, "setup", "Protected resource name : " + resourceProtected);
   log(Level.FINEST, "setup", "Unprotected resource name : " + resourceNotProtected);
   log(Level.FINEST, "setup", "Case sensitive resource name : " + resourceCase);
   polIdx = new Integer(policyIdx).intValue();
   mpc.createIdentities("agents" + fileseparator + strLocRB, polIdx);
   if (executeAgainstOpenSSO) {
     mpc.createPolicyXML(
         "agents" + fileseparator + strGblRB,
         "agents" + fileseparator + strLocRB,
         polIdx,
         strLocRB + ".xml");
     log(Level.FINEST, "setup", "Policy XML:\n" + strLocRB + ".xml");
     mpc.createPolicy(strLocRB + ".xml");
   } else log(Level.FINE, "setup", "Executing against non OpenSSO install");
   exiting("setup");
 }
Ejemplo n.º 2
0
 /** Deletes policies, user identities and destroys amadmin token. */
 @AfterClass(
     groups = {
       "ldapv3",
       "ldapv3_sec",
       "s1ds",
       "s1ds_sec",
       "ad",
       "ad_sec",
       "amsdk",
       "amsdk_sec",
       "jdbc",
       "jdbc_sec"
     })
 public void cleanup() throws Exception {
   entering("cleanup", null);
   if (executeAgainstOpenSSO) mpc.deletePolicies("agents" + fileseparator + strLocRB, polIdx);
   else log(Level.FINE, "cleanup", "Executing against non OpenSSO install");
   idmc.deleteIdentity(admintoken, realm, IdType.USER, "generalagenttests");
   destroyToken(admintoken);
   exiting("cleanup");
 }