I need to get current loggedin user's details along entertain session.Is there any poissible to do it in Spring
and hibernate
I am new to spring and hibernate...Help me guys.
I need to get current loggedin user's details along entertain session.Is there any poissible to do it in Spring
and hibernate
I am new to spring and hibernate...Help me guys.
There are serveral ways in which you can accomplish this. In a controller you can inject a Pricipal
as a parameter.
@RequestMapping()
public void getPricipal(Principal principal) {
Customer c = (Customer) pricipal;
}
You should also be able to inject the UserDetails
directly as well. Spring will resolve it for you. Your Customer
class must implement UserDetails
@RequestMapping()
public void getPricipal(Customer customer) {
}
As for having all details, you should be able to access the firstname, lastname etc, if you've implemented your own UserDetailsService
where you return your custom UserDetails
(Customer
).