1 Reply Latest reply on Mar 19, 2009 6:38 PM by bdaw

    JBoss Identity IDM 1.0.0.Alpha3 released

    bdaw

      JBoss Identity IDM component 1.0.0.Alpha3 was tagged today.

      Major changes are:

      1) Usage of persistence.xml and JPA EntityManager was removed. Now HibernateIdentityStore uses hibernate "cfg.xml" config. Build was updated to test with hibernate core 3.3.1.GA and hibernate annotations 3.4.0.GA

      2)
      Additional ways to provide already instantiated hibernate SessionFactory object were provided. It can be grabbed using JNDI or injected directly to IdentityConfiguration object:

      <option>
       <name>hibernateSessionFactoryRegistryName</name>
       <value>registeredSessionFactory1</value>
      </option>
      


      IdentityConfiguration identityConfiguration = new IdentityConfigurationImpl().
       configure("identity-config.xml");
      
      SessionFactory hibernateSessionFactory = new AnnotationConfiguration().configure("hibernate-jboss-identity-classes.cfg.xml")
       .buildSessionFactory();
      
      identityConfiguration.getIdentityConfigurationRegistry().register(hibernateSessionFactory, "registeredSessionFactory1");
      
      IdentitySessionFactory identitySessionFactory = identityConfiguration.buildIdentitySessionFactory();
      
      IdentitySession identitySession = identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
      identitySession.beginTransaction();
      


      3) Identity interface was renamed to User. Some of the API methods were renamed accordingly ( findAssociatedIdentities() --> findAssociatedUsers() and etc.)

      4) GroupType interface was removed. Currently plain String is used to describe type of a Group

      5) New usage of identity objects ids. IdentityType interface has getId() method that is inherited by Group and User objects. User object is uniquely identified by its ID within realm and it is provided during user creation:

      User aliceUser = identitySession.getPersistenceManager().createUser("Alice");
      assertEquals("Alice", aliceUser.getId());
      


      Group is uniquely identified by its name and type. It has unique name in scope of a given type within a realm. Id encodes this information in one String. Main purpose is to be able to use it as a method parameter:

      
      identitySession.getPersistenceManager().createUser("Olaf");
      Group atlantaOffice = identitySession.getPersistenceManager().createGroup("Atlanta", "OFFICE");
      identitySession.getPersistenceManager().createGroup("Chicago", "OFFICE");
      
      identitySession.getRelationshipManager().associateUserByIds(atlantaOffice.getId(), "Olaf");
      
      String chicagoOfficeId = identitySession.getPersistenceManager().createGroupId("Chicago", "OFFICE");
      
      identitySession.getRelationshipManager().associateUserByIds(chicagoOfficeId, "Olaf");
      
      


      Group ID for Atlanta office will be "group:/OFFICE/Atlanta". Prefix enables to distinct User and Group ids. Because it is a matter of internal implementation that may change in the future "PersistenceManager.createGroupId()" method should be used instead of manual creation.

      6)
      RelationshipManager contains 4 new methods:

      
      Collection<Group> findRelatedGroups(User user,
       String groupType,
       IdentitySearchControl[] controls)
      
      Collection<Group> findRelatedGroups(String userId,
       String groupType,
       IdentitySearchControl[] controls)
      
      Collection<User> findRelatedUsers(Group group, IdentitySearchControl[] controls)
      
      Collection<User> findRelatedUsers(String groupId, IdentitySearchControl[] controls)
      
      


      Unlike all other methods in RelationshipManager those will will return IdentityTypes connected both with association and a Role.

      
      User olaf = identitySession.getPersistenceManager().createUser("olaf");
      Group atlantaOffice = identitySession.getPersistenceManager().createGroup("Atlanta", "OFFICE");
      Group chicagoOffice = identitySession.getPersistenceManager().createGroup("Chicago", "OFFICE");
      
      identitySession.getRelationshipManager().associateUser(atlantaOffice, olaf);
      identitySession.getRoleManager().createRoleType("manager");
      identitySession.getRoleManager().createRole("manager", "olaf", chicagoOffice.getId());
      
      assertEquals(1, identitySession.getRelationshipManager().findAssociatedGroups("olaf", null, null).size());
      assertEquals(1, identitySession.getRoleManager().findGroupsWithRelatedRole("olaf", null).size());
      assertEquals(2, identitySession.getRelationshipManager().findRelatedGroups("olaf", null, null).size());
      
      


      7)
      New test cases and bug fixes...