I will assume that your database is different from the portal's database. Then your code should get the user identity from the portal and use that identity within your own database.
Thanks for your response! Do you think storing portal username and mapping to our databse customerId is reasonable approach then?
I think I would either need to implement AuthenticationEventListener
so mapping between my customer and portal user gets created if it has not existed before, or have a custom portlet that does that.
What do you think?
Not having done this, I am not sure of the best approach (perhaps someone who has done this can provide some insight). But having a listener that gets invoked when a new user registers would be ideal.
I'll try with the listener and see how it goes.
Might even post code here if all goes well.