Attribute Release Policy - External Groovy
Identical to inline groovy attribute definitions, except the groovy script can
also be externalized to a .groovy
file:
1
2
3
4
5
6
7
8
9
10
11
12
13
{
"@class" : "org.apereo.cas.services.CasRegisteredService",
"serviceId" : "sample",
"name" : "sample",
"id" : 300,
"attributeReleasePolicy" : {
"@class" : "org.apereo.cas.services.ReturnMappedAttributeReleasePolicy",
"allowedAttributes" : {
"@class" : "java.util.TreeMap",
"uid" : "file:/etc/cas/sample.groovy"
}
}
}
The sample.groovy
script itself may have the following outline:
1
2
3
4
5
6
7
import java.util.*
def run(final Object... args) {
def (attributes,logger) = args
logger.debug("Current attributes are {}", attributes)
return []
}
Usage Warning
Activating this policy is not without cost, as CAS needs to evaluate the inline script, compile and run it for subsequent executions. While the compiled script is cached and should help with execution performance, as a general rule, you should avoid opting for and designing complicated scripts.
The configuration of this component qualifies to use the Spring Expression Language syntax.