title: Displaying a property of a Spring Security class in Grails
body: <p>This is my user class that has Spring Security on it</p>
  
  <pre><code>package rms
  
  import java.util.Date;
  import java.util.Set;
  
  import enums.EmployeeStatus;
  
  class User {
  
     transient springSecurityService
  
     String username
     String password
     boolean enabled
     boolean accountExpired
     boolean accountLocked
     boolean passwordExpired
  
  
     String firstName
     String lastName
     String middleName
     String contactNumber
     String position
     String emailAddress
     String employeeID
     Date dateOfBirth
     EmployeeStatus employeeStatus
     int age
     byte [] picture
  
     static hasMany = [employeeReport: EmployeeReport]
  
     static constraints = {
        picture maxSize:20* 1024 * 1024
        dateOfBirth nullable: true
        employeeStatus blank: false
        position blank: false
        contactNumber blank: false
        emailAddress blank: false, matches: "([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})", email: true
        age min: 18
  
        username blank: false, unique: true
        password blank: false, password: true
     }
  
     static mapping = { password column: '`password`' }
  
     Set&lt;SecRole&gt; getAuthorities() {
        SecUserSecRole.findAllBySecUser(this).collect { it.secRole } as Set
     }
  
     def beforeInsert() {
        encodePassword()
     }
  
     def beforeUpdate() {
        if (isDirty('password')) {
           encodePassword()
        }
     }
  
     protected void encodePassword() {
        password = springSecurityService.encodePassword(password)
     }
  
     String toString(){
        return "SecUser $username"
     }
  }
  </code></pre>
  
  <p>I tried this tag <code>&lt;sec:loggedInUserInfo field="username"/&gt;</code> and it works fine but this doesn't work <code>&lt;sec:loggedInUserInfo field="firstName"/&gt;</code>. It gives a</p>
  
  <blockquote>
    <p>No such property: firstName for class: org.codehaus.groovy.grails.plugins.springsecurity.GrailsUser</p>
  </blockquote>
  
  <p>Is there any other way to display the other properties of the current logged in user?</p>