blob: fee2283bba229df040db5c609a78ed66e37062a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import org.springframework.security.core.context.SecurityContextHolder
class AuthTagLib {
private boolean isAuthenticated() {
//auth = session.SPRING_SECURITY_CONTEXT?.authentication?.authenticated
def auth = session["SPRING_SECURITY_CONTEXT"]
//log.info("auth is: ${auth}")
return auth != null
}
def ifAuthenticated = { attrs, body ->
if (isAuthenticated()) {
out << body()
}
}
def ifNotAuthenticated = { attrs, body ->
if (!isAuthenticated()) {
out << body()
}
}
}
|