summaryrefslogtreecommitdiffstats
path: root/idrop-web/grails-app/taglib/org/irods/mydrop/taglib/AuthTagLib.groovy
blob: 58e03b1740085d0cdf2072d8cb2b24eb26ca52da (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
package org.irods.mydrop.taglib

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()
		}
	 }

}