-
-
Notifications
You must be signed in to change notification settings - Fork 962
Open
Labels
Description
Hi,
I'm upgrading a project to version 7.0.0-M3 and I noticed that a taglib that is called in the main layout doesn't work correctly. For example:
class AuthService {
def springSecurityService // injected by Spring
def getCurrRoles() {
def auth = springSecurityService.authentication
def roles = auth?.authorities?.collect { it.authority } ?: []
log.info "roles = $roles"
roles
}
def getUser(){
def principal = springSecurityService.getPrincipal()
if(!principal || "anonymousUser".equals(principal.toString())){
return null
}
User.findWhere(username: springSecurityService.getPrincipal().username)
}
}
class AuthTagLib {
static namespace = "auth"
def authService
def roles = { attrs, body ->
out << authService.currRoles
}
def user = { attrs, body ->
out << authService.user
}
}
When I call (logged in) <auth:roles />
<auth:user />
from any page the values return correctly, but when I call it from main.gsp
it returns a empty list and null respectively. In version 6 the taglib responded correctly. Thanks!