2

I think I'm asking the same thing that the question here is asking.

Here is what I am doing:

1.) A user that is not in my database logs in to my application for the first time.

2.) The user is authenticated via LDAP

3.) I listen for an AuthenticationSuccessEvent. When detected I add the user to the my database if they do not exist, or update their info with the LDAP info if they do exist.

My problem is that if I add a user to my database for the first time they don't have an id until after they are added. I want to update the principal so id is accessible from the principal object.

I have tried the approach described here but it didn't work.

Community
  • 1
  • 1
ubiquibacon
  • 10,451
  • 28
  • 109
  • 179
  • It's not clear what you're asking, and it may even be impossible without code examples. – A.J. Brown Dec 13 '12 at 05:08
  • What I am saying is the principal's `id` is not accessible until they exist in my database (obviously), but even after the principal is added to the database there does not seem to be a good way to update the principal object during their current session. Thus, the principal's `id` cannot be accessed from the principal object until they are added to the database, log out, then log back in. – ubiquibacon Dec 13 '12 at 22:13
  • If you're using a sequence, after `principal.save()`, you should have an id in principal. If not, you need to flush the session. – A.J. Brown Dec 18 '12 at 17:10

0 Answers0