Sorry, you were right about creating an applicationContext-security.xml. I misread that (even though I copy/pasted it ...) as applicationContext.xml which you shouldn't edit. But the only way I could get this to work was to refer to a second app context xml file from web.xml in the contextConfigLocation attribute. I put it in WEB-INF along with applicationContext.xml:
Code:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
/WEB-INF/applicationContext-security.xml
</param-value>
</context-param>
I was also missing the config jar so I added that to the Ivy config in BuildConfig.groovy (you could also just copy the jars to the lib dir):
Code:
grails.project.class.dir = 'target/classes'
grails.project.test.class.dir = 'target/test-classes'
grails.project.test.reports.dir = 'target/test-reports'
grails.project.dependency.resolution = {
inherits 'global'
log 'warn'
repositories {
grailsPlugins()
grailsHome()
grailsCentral()
ebr() // SpringSource http://www.springsource.com/repository
}
dependencies {
runtime('org.springframework.security:org.springframework.security.core:3.0.3.RELEASE') {
excludes 'com.springsource.org.aopalliance',
'com.springsource.org.apache.commons.logging',
'org.springframework.beans',
'org.springframework.context',
'org.springframework.core'
}
runtime('org.springframework.security:org.springframework.security.config:3.0.3.RELEASE')
runtime('org.springframework.security:org.springframework.security.web:3.0.3.RELEASE') {
excludes 'com.springsource.javax.servlet',
'com.springsource.org.aopalliance',
'com.springsource.org.apache.commons.logging',
'org.springframework.aop',
'org.springframework.beans',
'org.springframework.context',
'org.springframework.core',
'org.springframework.web'
}
runtime('org.springframework.security:org.springframework.security.cas:3.0.3.RELEASE') {
excludes 'com.springsource.javax.servlet',
'com.springsource.org.aopalliance',
'com.springsource.org.apache.commons.logging',
'com.springsource.org.apache.xmlcommons',
'org.springframework.aop',
'org.springframework.beans',
'org.springframework.context',
'org.springframework.core',
'org.springframework.transaction',
'org.springframework.web'
}
}
}