Created
April 22, 2013 13:15
-
-
Save jdmr/5434799 to your computer and use it in GitHub Desktop.
Spring Security Service Current User Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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