8 Replies Latest reply on Jul 20, 2011 1:09 AM by arg20

    Seam Security Module, legacy database.

    arg20

      Hi, I've been learning about Seam Security module recently, since I am new to Seam. I have doubts about how to configure JpaIdentityStore with my current database schema.



      In JpaIdentityStore you have a table for identities which is responsible for storing users and groups. In our case we have a User table and a Group table, of course with a UserGroup join table. Since the user table has a lot of data about users, their name, email, password, etc, I can't really afford to do a redesign. Could anyone please elaborate on how to do these mappings?

        • 1. Re: Seam Security Module, legacy database.
          arg20

          Hi, I've been reading a bit more on this. I'm attempting to change my database schema, but there are some things that are unclear to me. An Identity object can have attributes, is that the way I am meant to store user's information such as name, etc? Since users' attributes are mapped to a different table using joins, it would severely decrease performance if I performed a lot of operations on those users, and it wouldn't be as clean as using a custom user entity.


          I currently have a User Table with fields such as email, name, phone number, and relationships to entities like reservations, etc. My question is how can I create a link between an Identity and its getUser() (which only has an id), and my current User object. Is there a way to integrate that?



          • 2. Re: Seam Security Module, legacy database.
            arg20

            Anyone? I need some light on this urgently.

            • 3. Re: Seam Security Module, legacy database.
              shane.bryzak

              You could use attributes to store that additional information, however I would probably just keep the user information (email, phones, etc) in a separate USER table, and have the IDENTITY_OBJECT table just point to it.

              • 4. Re: Seam Security Module, legacy database.
                arg20

                Shane thanks for the tip, now I hope you don't mind me asking a couple more questions. I've been reading the docs for version 2.x, it mentioned UserAction object to perform registrations, etc. Is this the way to go in 3.0.x too? I'm asking because I couldn't find anything about it in the latest documentation so it got me thinking that it might be deprecated. Also should I extend this bean to add properties related to my user?.


                Also the User interface that only returns the user's id, should I extend that in order to add name, email, etc? Or should I implement a different User object and have my idendity store its ID as an attribute so I can retrieve that User too? I hope I'm making sense here.

                • 5. Re: Seam Security Module, legacy database.
                  shane.bryzak

                  You should provide your own User entity class, however I just realized that we haven't provided the capability in Seam 3 to retrieve the actual entity object when a user is created.  We achieved this in Seam 2 by raising an event, however in Seam 3 the work is now done by the PicketLink API and we don't have that capability.  I'll need to think a bit about how we can solve this, could you possibly raise a feature request in JIRA so that we can track it there?

                  • 6. Re: Seam Security Module, legacy database.
                    arg20

                    Shane, thanks again, I've created a feature request in JIRA as you suggested, here's the link https://issues.jboss.org/browse/SEAMSECURITY-64


                    I'll see how I can implement this in the meantime.

                    • 7. Re: Seam Security Module, legacy database.
                      felipezf

                      Hi Gabriel,
                      Did you find a solution to implement this? I am with the same issue.
                      Tks!

                      • 8. Re: Seam Security Module, legacy database.
                        arg20

                        Felipe, I haven't had an answer on this yet. Unfortunately, I didn't have time to come up with a workaround, I'll be looking into this as soon as I can, hopefully Shane will fix this anytime soon.