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
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets.integrationTest {
|
|
|
|
groovy.srcDir file('src/integration-test/groovy')
|
|
|
|
}
|
|
|
|
|
|
|
|
eclipseClasspath {
|
|
|
|
plusConfigurations += configurations.integrationTestRuntime
|
2011-01-10 12:27:58 -05:00
|
|
|
}
|
|
|
|
|
2010-01-10 18:31:23 -05:00
|
|
|
dependencies {
|
2011-04-03 23:18:05 -04:00
|
|
|
groovy 'org.codehaus.groovy:groovy:1.7.7'
|
|
|
|
|
2010-12-20 17:12:35 -05:00
|
|
|
casServer "org.jasig.cas:cas-server-webapp:3.4.3.1@war"
|
2010-07-26 21:16:39 -04:00
|
|
|
|
2011-04-16 20:03:18 -04:00
|
|
|
providedCompile 'javax.servlet:servlet-api:2.5@jar'
|
|
|
|
|
|
|
|
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'),
|
|
|
|
'org.seleniumhq.selenium:selenium-htmlunit-driver:2.0a7',
|
|
|
|
'org.spockframework:spock-core:0.4-groovy-1.7',
|
|
|
|
'org.codehaus.geb:geb-spock:0.5.1',
|
|
|
|
'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"
|
2010-07-26 21:16:39 -04:00
|
|
|
def httpConnector = new org.mortbay.jetty.nio.SelectChannelConnector();
|
|
|
|
httpConnector.port = 8080
|
|
|
|
httpConnector.confidentialPort = 8443
|
|
|
|
def httpsConnector = new org.mortbay.jetty.security.SslSocketConnector();
|
|
|
|
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() {
|
|
|
|
System.setProperty('cas.server.host', casServer.httpsHost)
|
|
|
|
System.setProperty('cas.service.host', jettyRunWar.httpsHost)
|
|
|
|
}
|
2010-07-26 21:16:39 -04:00
|
|
|
}
|
2011-05-11 22:18:56 -04:00
|
|
|
task casServerOverlay(type: Sync) {
|
|
|
|
war = configurations.casServer.resolve().toArray()[0]
|
|
|
|
warName = war.name.replace('.war','-custom')
|
|
|
|
overlayDir = file('src/cas-server-overlay/webapp')
|
|
|
|
explodedWar = file("$buildDir/tmp/${warName}")
|
|
|
|
customWar = file("$buildDir/tmp/${warName}.war")
|
|
|
|
|
|
|
|
inputs.files(war, overlayDir)
|
|
|
|
outputs.files(customWar, explodedWar, file("$buildDir/tmp/expandedArchives"))
|
|
|
|
|
|
|
|
from zipTree(war)
|
|
|
|
from overlayDir
|
|
|
|
into explodedWar
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
if(customWar.exists()) {
|
|
|
|
customWar.delete()
|
|
|
|
}
|
|
|
|
ant.zip(destfile: customWar, baseDir: explodedWar)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
task casServer (type: org.gradle.api.plugins.jetty.JettyRunWar, dependsOn: 'casServerOverlay') {
|
2010-07-26 21:16:39 -04:00
|
|
|
contextPath = "/cas"
|
|
|
|
connectors = [new org.mortbay.jetty.security.SslSocketConnector()]
|
|
|
|
connectors[0].port = 9443
|
|
|
|
connectors[0].keystore = connectors[0].truststore = keystore
|
2011-04-03 23:18:05 -04:00
|
|
|
connectors[0].keyPassword = connectors[0].trustPassword = password
|
2010-07-26 21:16:39 -04:00
|
|
|
connectors[0].wantClientAuth = true
|
|
|
|
connectors[0].needClientAuth = false
|
2011-05-11 22:18:56 -04:00
|
|
|
webApp = casServerOverlay.customWar
|
|
|
|
|
|
|
|
inputs.file casServerOverlay.customWar
|
|
|
|
|
2010-07-26 21:16:39 -04:00
|
|
|
doFirst() {
|
|
|
|
System.setProperty('javax.net.ssl.trustStore', keystore)
|
2011-04-03 23:18:05 -04:00
|
|
|
System.setProperty('javax.net.ssl.trustStorePassword', password)
|
2010-07-26 21:16:39 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-10 12:27:58 -05:00
|
|
|
task cas (dependsOn: [jettyRunWar, 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 {
|
|
|
|
systemProperties['cas.server.host'] = casServer.httpsHost
|
|
|
|
systemProperties['cas.service.host'] = jettyRunWar.httpsHost
|
|
|
|
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 ->
|
|
|
|
if (graph.hasTask(cas)) {
|
2011-01-10 12:27:58 -05:00
|
|
|
jettyRunWar.dependsOn(casServer)
|
2010-12-20 17:12:35 -05:00
|
|
|
casServer.daemon = true
|
|
|
|
}
|
2011-04-03 23:18:05 -04:00
|
|
|
if(graph.hasTask(integrationTest)) {
|
|
|
|
jettyRunWar.daemon = true
|
|
|
|
jettyRunWar.httpConnector.port = availablePort()
|
|
|
|
jettyRunWar.httpsConnector.port = jettyRunWar.httpConnector.confidentialPort = availablePort()
|
|
|
|
casServer.httpsConnector.port = availablePort()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[casServer,jettyRunWar]*.metaClass*.getHttpsConnector {->
|
|
|
|
delegate.connectors.find { it instanceof org.mortbay.jetty.security.SslSocketConnector }
|
|
|
|
}
|
|
|
|
[casServer,jettyRunWar]*.metaClass*.getHttpsHost {->
|
|
|
|
"localhost:"+delegate.httpsConnector.port
|
|
|
|
}
|
|
|
|
jettyRunWar.metaClass.getHttpConnector {->
|
|
|
|
delegate.connectors.find { it instanceof org.mortbay.jetty.nio.SelectChannelConnector }
|
2010-07-26 21:16:39 -04:00
|
|
|
}
|
2011-04-03 23:18:05 -04:00
|
|
|
def availablePort() {
|
|
|
|
ServerSocket server = new ServerSocket(0)
|
|
|
|
int port = server.localPort
|
|
|
|
server.close()
|
|
|
|
port
|
|
|
|
}
|