2010-07-26 21:16:39 -04:00
|
|
|
// CAS sample build file
|
|
|
|
|
2010-03-28 18:54:41 -04:00
|
|
|
apply plugin: 'war'
|
|
|
|
apply plugin: 'jetty'
|
2011-04-03 23:18:05 -04:00
|
|
|
apply plugin: 'groovy'
|
2010-01-10 18:31:23 -05:00
|
|
|
|
2011-04-03 23:18:05 -04:00
|
|
|
def excludeModules = ['spring-security-acl', 'jsr250-api', 'spring-jdbc', 'spring-tx']
|
|
|
|
def jettyVersion = '7.1.6.v20100715'
|
|
|
|
def keystore = "$rootDir/samples/certificates/server.jks"
|
|
|
|
def password = 'password'
|
2011-01-10 12:27:58 -05:00
|
|
|
|
2010-07-26 21:16:39 -04:00
|
|
|
configurations {
|
|
|
|
casServer
|
2011-01-10 12:27:58 -05:00
|
|
|
excludeModules.each {name ->
|
|
|
|
runtime.exclude module: name
|
|
|
|
}
|
|
|
|
|
|
|
|
runtime.exclude group: 'org.aspectj'
|
2011-04-03 23:18:05 -04:00
|
|
|
|
|
|
|
integrationTestCompile.extendsFrom groovy
|
|
|
|
}
|
|
|
|
|
2012-08-31 16:49:28 -04:00
|
|
|
sourceSets {
|
|
|
|
test.resources.exclude 'GebConfig.groovy'
|
|
|
|
integrationTest.groovy.srcDir file('src/integration-test/groovy')
|
2011-04-03 23:18:05 -04:00
|
|
|
}
|
|
|
|
|
2012-06-29 13:59:22 -04:00
|
|
|
eclipse.classpath.plusConfigurations += configurations.integrationTestRuntime
|
2011-01-10 12:27:58 -05:00
|
|
|
|
2010-01-10 18:31:23 -05:00
|
|
|
dependencies {
|
2012-08-31 16:49:28 -04:00
|
|
|
groovy 'org.codehaus.groovy:groovy:1.8.7'
|
2011-04-03 23:18:05 -04:00
|
|
|
|
2012-11-28 18:56:03 -05:00
|
|
|
providedCompile "org.apache.tomcat:tomcat-servlet-api:$servletApiVersion"
|
2011-04-16 20:03:18 -04:00
|
|
|
|
|
|
|
compile project(':spring-security-core'),
|
2010-07-26 21:16:39 -04:00
|
|
|
project(':spring-security-cas'),
|
2011-04-16 20:03:18 -04:00
|
|
|
"org.jasig.cas.client:cas-client-core:3.1.12"
|
|
|
|
|
|
|
|
runtime project(':spring-security-web'),
|
2010-01-10 18:31:23 -05:00
|
|
|
project(':spring-security-config'),
|
2010-07-26 21:16:39 -04:00
|
|
|
"org.slf4j:jcl-over-slf4j:$slf4jVersion",
|
|
|
|
"ch.qos.logback:logback-classic:$logbackVersion"
|
|
|
|
|
2011-04-03 23:18:05 -04:00
|
|
|
integrationTestCompile project(':spring-security-cas'),
|
2012-08-31 16:49:28 -04:00
|
|
|
'org.seleniumhq.selenium:selenium-htmlunit-driver:2.25.0',
|
|
|
|
'org.spockframework:spock-core:0.6-groovy-1.8',
|
|
|
|
'org.codehaus.geb:geb-spock:0.7.2',
|
2011-04-03 23:18:05 -04:00
|
|
|
'commons-httpclient:commons-httpclient:3.1',
|
|
|
|
"org.eclipse.jetty:jetty-server:$jettyVersion",
|
|
|
|
"org.eclipse.jetty:jetty-servlet:$jettyVersion"
|
|
|
|
}
|
2010-07-26 21:16:39 -04:00
|
|
|
|
2011-01-10 12:27:58 -05:00
|
|
|
[jettyRun, jettyRunWar]*.configure {
|
2011-04-03 22:41:26 -04:00
|
|
|
contextPath = "/cas-sample"
|
2012-06-29 13:59:22 -04:00
|
|
|
def httpConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector').newInstance()
|
2010-07-26 21:16:39 -04:00
|
|
|
httpConnector.port = 8080
|
|
|
|
httpConnector.confidentialPort = 8443
|
2012-06-29 13:59:22 -04:00
|
|
|
def httpsConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector').newInstance()
|
2010-07-26 21:16:39 -04:00
|
|
|
httpsConnector.port = 8443
|
|
|
|
httpsConnector.keystore = httpsConnector.truststore = keystore
|
2011-04-03 23:18:05 -04:00
|
|
|
httpsConnector.keyPassword = httpsConnector.trustPassword = password
|
2010-07-26 21:16:39 -04:00
|
|
|
|
|
|
|
connectors = [httpConnector, httpsConnector]
|
2011-04-03 23:18:05 -04:00
|
|
|
doFirst() {
|
2011-05-12 22:46:29 -04:00
|
|
|
System.setProperty('cas.server.host', casServer().httpsHost)
|
2011-04-03 23:18:05 -04:00
|
|
|
System.setProperty('cas.service.host', jettyRunWar.httpsHost)
|
|
|
|
}
|
2010-07-26 21:16:39 -04:00
|
|
|
}
|
2011-05-11 22:47:40 -04:00
|
|
|
|
2011-05-15 22:28:20 -04:00
|
|
|
task cas (dependsOn: [jettyRunWar]) {
|
|
|
|
jettyRunWar.dependsOn(':spring-security-samples-casserver:casServer')
|
2011-05-11 22:47:40 -04:00
|
|
|
}
|
|
|
|
|
2011-05-12 22:46:29 -04:00
|
|
|
task casServer(dependsOn: ':spring-security-samples-casserver:casServer') {
|
2010-12-20 17:12:35 -05:00
|
|
|
}
|
2011-05-11 22:18:56 -04:00
|
|
|
|
2011-04-03 23:18:05 -04:00
|
|
|
integrationTest.dependsOn cas
|
|
|
|
integrationTest.doFirst {
|
2012-08-31 16:49:28 -04:00
|
|
|
def casServiceHost = jettyRunWar.httpsHost
|
2011-05-12 22:46:29 -04:00
|
|
|
systemProperties['cas.server.host'] = casServer().httpsHost
|
2012-08-31 16:49:28 -04:00
|
|
|
systemProperties['cas.service.host'] = casServiceHost
|
|
|
|
systemProperties['geb.build.baseUrl'] = 'https://'+casServiceHost+'/cas-sample/'
|
|
|
|
systemProperties['geb.build.reportsDir'] = 'build/geb-reports'
|
2011-04-03 23:18:05 -04:00
|
|
|
systemProperties['jar.path'] = jar.archivePath
|
|
|
|
systemProperties['javax.net.ssl.trustStore'] = keystore
|
|
|
|
systemProperties['javax.net.ssl.trustStorePassword'] = password
|
|
|
|
}
|
|
|
|
|
2010-12-20 17:12:35 -05:00
|
|
|
gradle.taskGraph.whenReady {graph ->
|
2011-05-12 22:46:29 -04:00
|
|
|
def casServer = casServer()
|
|
|
|
[casServer,jettyRunWar]*.metaClass*.getHttpsConnector {->
|
2012-06-29 13:59:22 -04:00
|
|
|
def sslSocketConnClass = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector')
|
|
|
|
delegate.connectors.find { it in sslSocketConnClass }
|
2011-05-12 22:46:29 -04:00
|
|
|
}
|
|
|
|
[casServer,jettyRunWar]*.metaClass*.getHttpsHost {->
|
|
|
|
"localhost:"+delegate.httpsConnector.port
|
|
|
|
}
|
|
|
|
jettyRunWar.metaClass.getHttpConnector {->
|
2012-06-29 13:59:22 -04:00
|
|
|
def channelConnClass = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector')
|
|
|
|
delegate.connectors.find { it in channelConnClass }
|
2011-05-12 22:46:29 -04:00
|
|
|
}
|
2010-12-20 17:12:35 -05:00
|
|
|
if (graph.hasTask(cas)) {
|
|
|
|
casServer.daemon = true
|
|
|
|
}
|
2011-04-03 23:18:05 -04:00
|
|
|
if(graph.hasTask(integrationTest)) {
|
2011-05-12 22:46:29 -04:00
|
|
|
tasks.getByPath(':spring-security-samples-casserver:casServerOverlay').logLevel = 'ERROR'
|
2012-11-01 12:14:50 -04:00
|
|
|
jettyRunWar {
|
|
|
|
additionalRuntimeJars += file("src/integration-test/resources")
|
|
|
|
daemon = true
|
|
|
|
}
|
|
|
|
|
|
|
|
[jettyRunWar.httpConnector,jettyRunWar.httpsConnector,casServer.httpsConnector]*.metaClass*.reservePort { taskToCloseSocket ->
|
|
|
|
def serverSocket = new ServerSocket(0)
|
|
|
|
delegate.metaClass.serverSocket = serverSocket
|
|
|
|
delegate.port = serverSocket.localPort
|
|
|
|
taskToCloseSocket.doFirst {
|
|
|
|
serverSocket.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[jettyRunWar.httpConnector,jettyRunWar.httpsConnector]*.reservePort(jettyRunWar)
|
|
|
|
jettyRunWar.httpConnector.confidentialPort = jettyRunWar.httpsConnector.port
|
|
|
|
casServer.httpsConnector.reservePort(casServer)
|
2011-04-03 23:18:05 -04:00
|
|
|
}
|
|
|
|
}
|
2011-05-12 22:46:29 -04:00
|
|
|
|
|
|
|
def casServer() {
|
|
|
|
tasks.getByPath(':spring-security-samples-casserver:casServer')
|
2012-11-01 12:14:50 -04:00
|
|
|
}
|