Package org.apache.jetspeed.security.mapping.model

Examples of org.apache.jetspeed.security.mapping.model.Entity


    }
   
    public void testFetchRolesForUserByRoleAttribute() throws Exception
    {
      
        Entity role1 = getInitialRole1();
        EntityImpl role3 = new EntityImpl("role", "Role3", roleAttrDefs);
        role3.setInternalId("cn=Role3, o=sevenSeas");
        role3.setAttribute(DESCRIPTION_ATTR_DEF.getName(), "Role 3");
        role3.setAttribute(CN_DEF.getName(), "Role3");
        role3.setAttribute(UNIQUEMEMBER_ATTR_DEF.getName(), Arrays.asList(new String[]{
View Full Code Here


    {
        this.attributeContainsInternalId = attributeContainsInternalId;
    }

    private Entity getLiveEntity(EntityDAO dao, Entity transientEntity) throws SecurityException {
        Entity liveEntity = dao.getEntity(transientEntity.getId());
        if (liveEntity == null){
            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(transientEntity.getType(), transientEntity.getId()));
        }
        if (liveEntity.getInternalId() == null){
            throw new SecurityException(SecurityException.UNEXPECTED.create(getClass().getName(),"getLiveEntity","Internal ID not found"));
        }
        return liveEntity;
    }
View Full Code Here

    public Collection<Entity> getEntitiesByInternalId(Collection<String> internalIds)
    {
        final Collection<Entity> resultSet = new ArrayList<Entity>();
        for (Iterator<String> iterator = internalIds.iterator(); iterator.hasNext();)
        {
            Entity resultEntity = getEntityByInternalId(iterator.next());
            if (resultEntity != null)
            {
                resultSet.add(resultEntity);
            }
        }
View Full Code Here

        }
        return resultSet;
    }
   
    public Entity getEntityByInternalId(String internalId){
        Entity resultEntity = null;
        DistinguishedName principalDN = getRelativeDN(internalId);
        String relativeDN = principalDN.toCompactString();
        String searchDNStr = searchDN.toCompactString();
        if (relativeDN.equals(searchDNStr) || relativeDN.endsWith(searchDNStr)){
            internalId = principalDN.toCompactString();
View Full Code Here

    private void internalUpdate(Entity entity, UpdateMode umode) throws SecurityException
    {
        String internalId = entity.getInternalId();
        if (internalId == null){
            Entity ldapEntity = getEntity(entity.getId());
            if (ldapEntity == null || ldapEntity.getInternalId() == null) { throw new SecurityException(SecurityException.PRINCIPAL_UPDATE_FAILURE.createScoped(entity.getType(), entity.getId())); }
            internalId=ldapEntity.getInternalId();
        }
       
        Name dn = getRelativeDN(internalId);
        DirContextOperations dirCtxOps = null;
        ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
View Full Code Here

    {
        if (!entityExists(entity)) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(entity.getType(), entity.getId())); }
        String internalIdStr = entity.getInternalId();
        if (internalIdStr == null)
        {
            Entity ldapEntity = getEntity(entity.getId());
            if (ldapEntity == null || ldapEntity.getInternalId() == null)
            {
                // TODO throw exception
                return;
            } else
            {
                internalIdStr = ldapEntity.getInternalId();
            }
        }
        ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
        try
        {
View Full Code Here

                                                               : securityEntityManager.getRelatedEntitiesTo(entity, relationTypeForThisEntity);
        Collection<Long> externalRelatedEntityIds = new ArrayList<Long>();
        if (relatedEntities != null){
            for (Entity relatedEntity : relatedEntities)
            {
                Entity fromEntity = entityIsFromEntity ? entity : relatedEntity;
                Entity toEntity = entityIsFromEntity ? relatedEntity : entity;
                if (!syncState.isRelationProcessed(relationTypeForThisEntity, fromEntity, toEntity))
                {
                    // first flag the relation as processed to
                    // prevent synchronizing the same relation from
                    // the other side.
View Full Code Here

        attrDefs.add(new AttributeDefImpl("company"));       
       
        StubEntityFactory stubFactory = new StubEntityFactory();
        stubFactory.setAttributeDefs(attrDefs);
       
        Entity user_jsmith=stubFactory.createEntity("jsmith", "user", new String[]{"John Smith","IBM"});
        Entity user_jdoe=stubFactory.createEntity("jdoe", "user", new String[]{"Jane Doe","Apple"});

        StubEntityDAO userDao = new StubEntityDAO();
        userDao.addEntity(user_jsmith);
        userDao.addEntity(user_jdoe);
       
        Entity role_manager=stubFactory.createEntity("manager", "role", new String[]{"Manager Role",""});
        Entity role_admin=stubFactory.createEntity("admin", "role", new String[]{"Admin Role",""});
        Entity role_random=stubFactory.createEntity("random", "role", new String[]{"Random Role",""});
        Entity role_yetAnother=stubFactory.createEntity("yetAnotherRole", "role", new String[]{"Yet Another Role",""});
       
        StubEntityDAO roleDao = new StubEntityDAO();
        userDao.addEntity(role_manager);
        userDao.addEntity(role_admin);
        userDao.addEntity(role_random);
        userDao.addEntity(role_yetAnother);

       
        Entity group_programmers=stubFactory.createEntity("programmers", "group", new String[]{"Group for Programmers",""});
        Entity group_board=stubFactory.createEntity("boardOfDirectors", "group", new String[]{"Group for the board of directors",""});
        Entity group_random=stubFactory.createEntity("randomGroup", "group", new String[]{"Random Group",""});
        Entity group_yetAnother=stubFactory.createEntity("yetAnotherGroup", "group", new String[]{"Yet Another Group",""});

        StubEntityDAO groupDao = new StubEntityDAO();
        userDao.addEntity(group_programmers);
        userDao.addEntity(group_board);
        userDao.addEntity(group_random);
View Full Code Here

    }

    public Entity createEntity(DirContext ctx)
    {
        String entityId = null;
        Entity entity = null;
        Set<Attribute> attributes = new HashSet<Attribute>();
        for (AttributeDef attrDef : searchConfiguration.getAttributeDefinitions())
        {
            String[] values = null;
            try
View Full Code Here

    }

    public void addEntity(Entity entity, Entity parentEntity) throws SecurityException
    {
        EntityDAO parentEntityDao = getDAOForEntity(parentEntity);
        Entity liveParentEntity = null;
        if (parentEntityDao!=null){
            // fetch "live" entity from LDAP to
            // 1) check whether entity exists and
            // 2) fetch all LDAP attributes (mapped and not mapped) + fill the internal ID
            liveParentEntity=parentEntityDao.getEntity(parentEntity.getId());
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.security.mapping.model.Entity

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.