Package org.ejbca.core.model.authorization

Examples of org.ejbca.core.model.authorization.AdminEntity


            // Remove from admin group
            CAInfo cainfo = caAdminSessionRemote.getCAInfo(intAdmin, getAdminCAName());
            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)) {
                    ArrayList<AdminEntity> list = new ArrayList<AdminEntity>();
                    list.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASE, TEST_ADMIN_USERNAME, cainfo.getCAId()));
                    adminEntitySession.removeAdminEntities(intAdmin, AdminGroup.TEMPSUPERADMINGROUP, list);
                    authorizationSession.forceRuleUpdate(intAdmin);
                }
            }
            // Remove user
View Full Code Here


    if (matchValue==null || "".equals(matchValue)) {
      addErrorMessage("MATCHVALUEREQUIRED");
      return;
    }
    int caid = Integer.parseInt(getMatchCaId());
    AdminEntity adminEntity = new AdminEntity(matchWith, matchType, matchValue, caid);
    // TODO: Check if adminentity exist and add a nice errormessage instead of being silent
    Collection<AdminEntity> adminEntities = new ArrayList<AdminEntity>();
    adminEntities.add(adminEntity);
    try {
      getAuthorizationDataHandler().addAdminEntities(getCurrentAdminGroup(), adminEntities);
View Full Code Here

    }
  }

  /** Removes an admin from the current group. */
  public void deleteAdmin() {
    AdminEntity adminEntity =  getAdminForEach();
    Collection<AdminEntity> adminEntities = new ArrayList<AdminEntity>();
    adminEntities.add(adminEntity);
    try {
      getAuthorizationDataHandler().removeAdminEntities(getCurrentAdminGroup(), adminEntities);
    } catch (AuthorizationDeniedException e) {
View Full Code Here

    return list;
  }

  /** @return the name of the CA that has issed the certificate for the admin in the current row of the datatable */
  public String getIssuingCA() {
    AdminEntity adminEntity = getAdminForEach();
    String caName = (String) ejb.getCaAdminSession().getCAIdToNameMap(EjbcaJSFHelper.getBean().getAdmin()).get(adminEntity.getCaId());
    if (caName == null) {
      caName = "Unknown CA with hash " + adminEntity.getCaId();
    }
    return caName;
  }
View Full Code Here

    return getEjbcaWebBean().getText( AdminEntity.MATCHWITHTEXTS[getAdminForEach().getMatchWith()] );
  }

  /** @return the 'match type'-text for the admin in the current row of the datatable */
  public String getAdminsMatchType() {
    AdminEntity adminEntity =  getAdminForEach();
    if (adminEntity.getMatchType() < AdminEntity.SPECIALADMIN_PUBLICWEBUSER) {
      return getEjbcaWebBean().getText( AdminEntity.MATCHTYPETEXTS[adminEntity.getMatchType()-1000] );
    }
    return "" + adminEntity.getMatchType();
  }
View Full Code Here

        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();

        adminEntities = new ArrayList<AdminEntity>();
        adminEntities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, adminusername1, caid));
        adminEntitySession.addAdminEntities(intadmin, AdminGroup.TEMPSUPERADMINGROUP, adminEntities);

        authorizationSession.forceRuleUpdate(intadmin);

        admincert1 = (X509Certificate) certificateStoreSession.findCertificatesByUsername(intadmin, adminusername1).iterator().next();
View Full Code Here

        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();
        tmpfile.delete();

        List<AdminEntity> adminEntities = new ArrayList<AdminEntity>();
        adminEntities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, adminusername, caid));
        adminEntitySession.addAdminEntities(intadmin, AdminGroup.TEMPSUPERADMINGROUP, adminEntities);
        authorizationSession.forceRuleUpdate(intadmin);

        X509Certificate admincert = (X509Certificate) certificateStoreSession.findCertificatesByUsername(intadmin, adminusername).iterator().next();
        Admin admin = new Admin(admincert, adminusername, null);
View Full Code Here

        cleanUpAdminGroupTests(anAdmin, TEST_GROUPNAME, accessrules);
        adminGroupSession.addAdminGroup(anAdmin, TEST_GROUPNAME);

        List<AdminEntity> adminEntities = new ArrayList<AdminEntity>();
        adminEntities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, testCaName, ("CN=" + testCaName).hashCode()));
        adminEntitySession.addAdminEntities(anAdmin, TEST_GROUPNAME, adminEntities);

        adminGroupSession.addAccessRules(anAdmin, TEST_GROUPNAME, accessrules);

        authorizationSession.forceRuleUpdate(admin);
View Full Code Here

        cleanUpAdminGroupTests(anAdmin, TEST_GROUPNAME, accessrules);
        adminGroupSession.addAdminGroup(anAdmin, TEST_GROUPNAME);

        try {
            List<AdminEntity> adminEntities = new ArrayList<AdminEntity>();
            adminEntities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, DEFAULT_SUPERADMIN_CN,
                    "CN=TEST Authorization,O=PrimeKey,C=SE".hashCode()));
           
            adminEntitySession.addAdminEntities(anAdmin, TEST_GROUPNAME, adminEntities);

            assertFalse("Admin of type " + anAdmin + " with username " + anAdmin.getUsername() + " was authorized to group <" + TEST_GROUPNAME
View Full Code Here

            makep12.setMainStoreDir(tmpfile.getParent());
            makep12.createAllNew();
            tmpfile.delete();
           
            adminentities = new ArrayList<AdminEntity>();
            adminentities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, adminusername1, caid));
            adminentities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, adminusername2, caid));
            adminentities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, reqadminusername, caid));
            adminentities.add(new AdminEntity(AdminEntity.WITH_SERIALNUMBER, AdminEntity.TYPE_EQUALCASEINS, CertTools.getSerialNumberAsString(externalcert), "CN=externalCert,C=SE".hashCode()));
            adminEntitySession.addAdminEntities(intadmin, AdminGroup.TEMPSUPERADMINGROUP, adminentities);
            authorizationSession.forceRuleUpdate(intadmin);

            admincert1 = (X509Certificate) certificateStoreSession.findCertificatesByUsername(intadmin, adminusername1).iterator().next();
            admincert2 = (X509Certificate) certificateStoreSession.findCertificatesByUsername(intadmin, adminusername2).iterator().next();
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.authorization.AdminEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.