Skip to content

Instantly share code, notes, and snippets.

@jdmr
Created April 22, 2013 13:15
Show Gist options
  • Save jdmr/5434799 to your computer and use it in GitHub Desktop.
Save jdmr/5434799 to your computer and use it in GitHub Desktop.
Spring Security Service Current User Example
package demo
class HomeController {
def springSecurityService
def index() {
User user = springSecurityService.currentUser
if (user) {
log.debug("Hello ${user.username}")
} else {
log.debug("Hello anonymous")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment