facebook

Security – retrieving additional user data

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #352630 Reply

    dknutson
    Member

    I’ve setup a project with spring security. My Users table is modified to include a column titled fullname. I want to use fullname when displaying information on who is logged in.

    I’ve added the column to the queries in the security-content.xml

    <beans:property name=”usersByUsernameQuery” value=”SELECT username,password,enabled,fullname FROM Users WHERE username = ?”/>
    <beans:property name=”authoritiesByUsernameQuery” value=”SELECT u.username, u.fullname, a.authorityname FROM Users u JOIN Users_Authorities ua on u.id = ua.user_id JOIN Authorities a on ua.authorities_id = a.id WHERE u.username = ?”/>

    I’ve also added setter/getter to the Users.java that security created. If I then use the following command –

    <sec:authentication property=”principal.fullname”/>

    I then get this message –

    org.apache.jasper.JasperException: org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: org.springframework.beans.NotReadablePropertyException: Invalid property ‘principal.fullname’ of bean class [org.springframework.security.authentication.UsernamePasswordAuthenticationToken]: Bean property ‘principal.fullname’ is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

    Am I even going down the right path with this? What throws me is that the classes generated for User, UserDAO and UserDAOImpl do not show any query statements. Are they even used? Or are they placeholders in case I want to use them – and if so then I need to add the @NameQueries statements and supporting methods.

    #352645 Reply

    dknutson,

    This is a development query. I would suggest you to cross post on development forums (for ex: http://www.stackoverflow.com) for better support on this.

    Let us know if you see any issues in MyEclipse.

    #353106 Reply

    nawaz777
    Member

    Hi Neil,

    I am experimenting with different configurations to see what seems to work best (or work period in some cases). There are so many tempting plugins and scaffolding options that it’s very tempting to over-consume and end up with plugin diabetes!

    ______________________
    C4120-782 vce

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Security – retrieving additional user data

You must be logged in to post in the forum log in