grails - getting currently logged in JsecUser username in gsp?

In grails,

is there a way to get the currently logged in username from within a .gsp?

I need it in the base index.gsp, so adding it to the flash scope from a controller isn't an option.

I suppose I could add a new tag to JsecTagLib.groovy... but I'm not sure how to get the current user from within Groovy (I'm new to JSecurity).

Thanks,

Hamlet D'Arcy

Hi Hamlet! I believe you'll

Hi Hamlet!

I believe you'll need to direct this question to the Grails Mailing Lists (Grails User to be exact), as it is inherently Groovy/Grails specific. The core JSecurity team didn't write the Grails plugin - it is written and maintained by a gent by the name of Peter Ledbrook. He's in close contact with us and we support him whenever he asks, but we don't know all of the details of the .groovy code he's written for the plugin.

I do know that once you have access to a SecurityContext, you can get the user's primary principal (usually a username or user id) by calling securityContext.getPrincipal (or in Groovy parlance, securityContext.principal).

Cheers,

Les