3 Replies Latest reply on Aug 31, 2010 7:35 PM by Sean Whyte

    Storing User Profile in LDAP

    Art Munro Novice

      The User Profile currently contains the following fields

      Given Name:

      Family Name:

      NickName:

      Birthday:

      Gender

      Employer

      Department

      Job Title

      Language

       

      How do I store this information in LDAP with the Account information?

       

      I currently am running Gatein 3.1 on Tomcat with Open LDAP and Postgre DB.

        • 1. Re: Storing User Profile in LDAP
          Art Munro Novice

          Anyone have any idea on how to do this?  I have tried to add additional attributes to IDM configurations but does not seem to change anything

           

          thoughts out there?

          • 2. Re: Storing User Profile in LDAP
            Art Munro Novice

            Ok I think im getting closer...

            http://community.jboss.org/message/535583#535583  Aslan has posted a sample create profile

            OrganizationService service = (OrganizationService) PortalContainer.getInstance().getComponentInstanceOfType(OrganizationService.class);

            ...

            UserProfile profile = service.getUserProfileHandler().createUserProfileInstance(userid);

            profile.setAttribute("position", request.getParameter(FIELD_POSITION));

            profile.setAttribute("phone", request.getParameter(FIELD_PHONE));

            service.getUserProfileHandler().saveUserProfile(profile, false);

               

               

              So now I know the right area of code to search... NEXT

               

               

              http://community.jboss.org/message/537061#537061  Interacting with IDM Picketlink  Sean was able to add and map attribute Employer

               

               

              PortalContainer container = PortalContainer.getInstance();
              OrganizationService orgService = (OrganizationService) container.getComponentInstanceOfType(OrganizationService.class);

              UserHandler userHandler = orgService.getUserHandler();
              User user = userHandler.findUserByName(request.getUserPrincipal().getName());

              UserProfileHandler profileHandler = orgService.getUserProfileHandler();
              UserProfile profile = profileHandler.findUserProfileByName(user.getUserName());

              <attribute>
                       <name>user.employer</name>
                       <mapping>company</mapping>
                       <type>text</type>
                       <isRequired>false</isRequired>
                       <isMultivalued>false</isMultivalued>
                       <isReadOnly>false</isReadOnly>
                       <isUnique>true</isUnique>
              </attribute>

               

              SO NOW...

              what are the attribute names/mappings that will work for the remainder fields

               

              ANY help??

               

               

              Re: How can i register user with my own portlet?

              Re: Ldap (Active Directory) fields and user attributes

              • 3. Re: Storing User Profile in LDAP
                Sean Whyte Newbie

                The only information I found was from an old jboss-portal page:

                [http://docs.jboss.org/jbportal/v2.7.0/javadoc-bundle/common/constant-values.html]

                 

                The section that is important is the P3PConstants. All the values on the right hand side appear to work for mapping to AD.

                 

                I found them by going into AD and adding a bunch of values to an AD user and then generating an LDIF to show what fields they actually mapped to.

                These are the attributes I used (where 'name' is the GateIn property, and 'mapping' is the corresponding AD value)

                 

                 

                              <attribute>
                                <name>user.employer</name>
                                <mapping>company</mapping>
                                <type>text</type>
                                <isRequired>false</isRequired>
                                <isMultivalued>false</isMultivalued>
                                <isReadOnly>false</isReadOnly>
                                <isUnique>true</isUnique>
                              </attribute>
                              <attribute>
                                <name>user.department</name>
                                <mapping>department</mapping>
                                <type>text</type>
                                <isRequired>false</isRequired>
                                <isMultivalued>false</isMultivalued>
                                <isReadOnly>false</isReadOnly>
                                <isUnique>true</isUnique>
                              </attribute>
                              <attribute>
                                <name>user.business-info.postal.street</name>
                                <mapping>streetAddress</mapping>
                                <type>text</type>
                                <isRequired>false</isRequired>
                                <isMultivalued>false</isMultivalued>
                                <isReadOnly>false</isReadOnly>
                                <isUnique>true</isUnique>
                              </attribute>
                              <attribute>
                                <name>user.business-info.postal.city</name>
                                <mapping>l</mapping>
                                <type>text</type>
                                <isRequired>false</isRequired>
                                <isMultivalued>false</isMultivalued>
                                <isReadOnly>false</isReadOnly>
                                <isUnique>true</isUnique>
                              </attribute>
                              <attribute>
                                <name>user.business-info.postal.stateprov</name>
                                <mapping>st</mapping>
                                <type>text</type>
                                <isRequired>false</isRequired>
                                <isMultivalued>false</isMultivalued>
                                <isReadOnly>false</isReadOnly>
                                <isUnique>true</isUnique>
                              </attribute>
                              <attribute>
                                <name>user.business-info.postal.country</name>
                                <mapping>co</mapping>
                                <type>text</type>
                                <isRequired>false</isRequired>
                                <isMultivalued>false</isMultivalued>
                                <isReadOnly>false</isReadOnly>
                                <isUnique>true</isUnique>
                              </attribute>
                              <attribute>
                                <name>user.business-info.postal.postalcode</name>
                                <mapping>postalCode</mapping>
                                <type>text</type>
                                <isRequired>false</isRequired>
                                <isMultivalued>false</isMultivalued>
                                <isReadOnly>false</isReadOnly>
                                <isUnique>true</isUnique>
                              </attribute>
                              <attribute>
                                <name>user.business-info.telecom.telephone.number</name>
                                <mapping>telephoneNumber</mapping>
                                <type>text</type>
                                <isRequired>false</isRequired>
                                <isMultivalued>false</isMultivalued>
                                <isReadOnly>false</isReadOnly>
                                <isUnique>true</isUnique>
                              </attribute>
                              <attribute>
                                <name>user.jobtitle</name>
                                <mapping>title</mapping>
                                <type>text</type>
                                <isRequired>false</isRequired>
                                <isMultivalued>false</isMultivalued>
                                <isReadOnly>false</isReadOnly>
                                <isUnique>true</isUnique>
                              </attribute>