protected void setupAccessRights() throws Exception {
boolean userAdded = false;
if (!userAdminSession.existsUser(intAdmin, TEST_ADMIN_USERNAME)) {
UserDataVO user1 = new UserDataVO();
user1.setUsername(TEST_ADMIN_USERNAME);
user1.setPassword("foo123");
user1.setDN("CN=wstest");
CAInfo cainfo = caAdminSessionRemote.getCAInfo(intAdmin, getAdminCAName());
assertNotNull("No CA with name "+getAdminCAName()+" was found.", cainfo);
user1.setCAId(cainfo.getCAId());
user1.setEmail(null);
user1.setSubjectAltName(null);
user1.setStatus(UserDataVOWS.STATUS_NEW);
user1.setTokenType(SecConst.TOKEN_SOFT_JKS);
user1.setEndEntityProfileId(SecConst.EMPTY_ENDENTITYPROFILE);
user1.setCertificateProfileId(SecConst.CERTPROFILE_FIXED_ENDUSER);
user1.setType(65);
userAdminSession.addUser(intAdmin, user1, true);
userAdded = true;
boolean adminExists = false;
AdminGroup admingroup = adminGroupSession.getAdminGroup(intAdmin, AdminGroup.TEMPSUPERADMINGROUP);
Iterator<AdminEntity> iter = admingroup.getAdminEntities().iterator();
while (iter.hasNext()) {
AdminEntity adminEntity = iter.next();
if (adminEntity.getMatchValue().equals(TEST_ADMIN_USERNAME)) {
adminExists = true;
}
}
if (!adminExists) {
List<AdminEntity> list = new ArrayList<AdminEntity>();
list.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASE, TEST_ADMIN_USERNAME, cainfo.getCAId()));
adminEntitySession.addAdminEntities(intAdmin, AdminGroup.TEMPSUPERADMINGROUP, list);
authorizationSession.forceRuleUpdate(intAdmin);
}
}
if (!userAdminSession.existsUser(intAdmin, TEST_NONADMIN_USERNAME)) {
UserDataVO user1 = new UserDataVO();
user1.setUsername(TEST_NONADMIN_USERNAME);
user1.setPassword("foo123");
user1.setDN("CN=wsnonadmintest");
CAInfo cainfo = caAdminSessionRemote.getCAInfo(intAdmin, getAdminCAName());
user1.setCAId(cainfo.getCAId());
user1.setEmail(null);
user1.setSubjectAltName(null);
user1.setStatus(UserDataVOWS.STATUS_NEW);
user1.setTokenType(SecConst.TOKEN_SOFT_JKS);
user1.setEndEntityProfileId(SecConst.EMPTY_ENDENTITYPROFILE);
user1.setCertificateProfileId(SecConst.CERTPROFILE_FIXED_ENDUSER);
user1.setType(1);
userAdminSession.addUser(intAdmin, user1, true);
userAdded = true;
}