Announcement Announcement Module
Collapse
No announcement yet.
Output UserDetails properties in JSPX with support for form and OpenID login Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Output UserDetails properties in JSPX with support for form and OpenID login

    I am not sure how, really, to ask this, nor if this is the right place, but hopefully someone can understand this and at least direct me in the correct place.

    I am working on a Roo site that was using basic form login w/ Spring Security, in which the user data was stored in a DB table and retrieved using the JdbcUserDetailsService to pull back the user information. Now, I want to get OpenID working in addition to the normal form login, such that the user has the option of either signing up for an account on my site OR using the OpenID. I used the samples in Spring Security 3.1.0.RELEASE to accomplish this, and the authentication piece seems to be working perfectly (even have auto-register for OpenID logins).

    The problem is that I use the following in the JSPX code all over the place:
    Code:
    ${pageContext['request'].userPrincipal.name}
    Especially in dealing with the users "profile", as part of the URL itself. However, with OpenID, the "username" is the full URL with the OpenID id in the path somewhere, and not condusive for doing things like:
    Code:
    Hello, ${pageContext['request'].userPrincipal.name}, welcome to my site!
    So, I added an alias field to my UserDetails, but I am not sure how to get it from the JSPX. I use the above snippet in the header, which doesn't get loaded as part of any particular Controller call, but is rather pulled in via Tiles, so I can't just look up the User object because I would have to do that all over the place. It looks like the object that gets returned on an OpenID login for
    Code:
    pageContext['request'].userPrincipal
    is actually an instance of org.springframework.security.openid.OpenIDAuthenti cationToken.

    So, my questions are:
    1. Can you get to the UserDetails object some other, more generic way via JSPX?
    2. If not, is there some way, outside of aspects, to have something run before/after every method on an MVC Controller?
    3. Is there some other way to do this that I haven't thought of?

    I didn't include any real code snippets because I didn't feel they were really relavent to the ultimate question, but I can include those if need be.
Working...
X