Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8696489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:16:55+00:00 2026-06-13T01:16:55+00:00

I have a basic Grails 2 application which I setup along with the SpringSecurityCore

  • 0

I have a basic Grails 2 application which I setup along with the SpringSecurityCore plugin. This seems to be working fine. However, when I try to add additional properties to my User.groovy file by way of an extended class, I cannot seem to reference those properties in my controllers.

To better illustrate this problem, please take a look at my basic class which extends the User.groovy:

UserInfo.groovy:

class UserInfo extends User {

String firstname
String lastname
}

On my page where I want to reference the current user’s firstname, I am simply writing a method as follows:

def index() { 


        def uname = springSecurityService.currentUser.username
        def firstname = springSecurityService.currentUser.firstname

        render uname

    }

This works fine for rendering the username, and I believe that this is because the username is referenced in the base User.groovy file:

class User {

transient springSecurityService

String username
String password

However, the above “def index()” method fails when I try to define the firstname as part of the springSecurityService.currentUser.firstname.

If I inject extra properties into the base User.groovy class, then I can reference them by way of springSecurityService.currentUser.[property]

To illustrate this:

class User {

transient springSecurityService

String username
String password
    String firstname
    ...

I am then able to reference the firstname property of my user in the aforementioned index method.

Is it possible to reference the extended properties of my User without injecting values in the base User class? My goal here is to try and keep the User class as clean as possible while still being able to call upon the values referenced in the UserInfo.groovy file.

Thank you in advance for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:16:57+00:00Added an answer on June 13, 2026 at 1:16 am

    If you really need to put some properties of your User information into another domain and want those properties could still be accessed from springSecurityService.currentUser, you have to implement your own UserDetailsService to package the UserInfo properties with User.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic nServicebus 3.2.0 setup with a web application endpoint and a
I have basic client-side validation working in my MVC3 RC2 application, but I'm now
I have just gotten started with Grails and I have a very basic application
This is on Grails! This is a very basic thing which apperatnly I am
I'm developing a Grails (Version 1.3.3) Web-Application using the Grails Spring-Security Plugin, Spring-Security-Core-1.0.1 (which,
I've an basic app that working fine when i'm runngin it with grails run-app
I have basic Spring MVC 3 setup for i18n where I can show labels
I have a basic web application written in Java, running on a tomcat on
I am using grails and i have a basic form remote <g:formRemote name=add onSuccess=close();
This may be a basic question but I am new to grails and tried

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.