Accessing my custom user object in jsp page, using spring 3 security



I have implemented UserDetailsService, it returns an instance of MyUser (which implements UserDetails)

public MyUser loadUserByUsername(String arg0)

Now I want to access my custom getters/fields on MyUser in my JSP pages, so far I got this:


But that only allows access to a Principal object. How can I access MyUser object?





its easy in the jsp page I added this :

<%@ taglib prefix="sec" uri="" %>
<sec:authentication property="principal.firstname" /> 

Where principal is actually an instance of MyUser, so “firstname” can be any of my custom getters and setters


Facebook Comments

Post a comment