Standardize Build
The build now uses spring build conventions to simplify the build Fixes gh-4284
This commit is contained in:
+23
-26
@@ -1,11 +1,8 @@
|
||||
// CAS sample build file
|
||||
|
||||
apply plugin: 'io.spring.convention.spring-sample'
|
||||
apply plugin: 'war'
|
||||
apply plugin: 'jetty'
|
||||
apply plugin: 'groovy'
|
||||
|
||||
def excludeModules = ['spring-security-acl', 'jsr250-api', 'spring-jdbc', 'spring-tx']
|
||||
def jettyVersion = '8.1.9.v20130131'
|
||||
def keystore = "$rootDir/samples/certificates/server.jks"
|
||||
def password = 'password'
|
||||
|
||||
@@ -26,32 +23,31 @@ sourceSets {
|
||||
eclipse.classpath.plusConfigurations += [configurations.integrationTestRuntime]
|
||||
|
||||
dependencies {
|
||||
providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"
|
||||
compile project(':spring-security-cas')
|
||||
compile project(':spring-security-core')
|
||||
compile 'org.jasig.cas.client:cas-client-core'
|
||||
|
||||
compile project(':spring-security-core'),
|
||||
project(':spring-security-cas'),
|
||||
"org.jasig.cas.client:cas-client-core:$casClientVersion"
|
||||
providedCompile 'javax.servlet:javax.servlet-api'
|
||||
|
||||
runtime project(':spring-security-web'),
|
||||
project(':spring-security-config'),
|
||||
"org.springframework:spring-context-support:$springVersion",
|
||||
"org.slf4j:jcl-over-slf4j:$slf4jVersion",
|
||||
"ch.qos.logback:logback-classic:$logbackVersion",
|
||||
"net.sf.ehcache:ehcache:$ehcacheVersion"
|
||||
runtime project(':spring-security-config')
|
||||
runtime project(':spring-security-web')
|
||||
runtime 'ch.qos.logback:logback-classic'
|
||||
runtime 'net.sf.ehcache:ehcache'
|
||||
runtime 'org.slf4j:jcl-over-slf4j'
|
||||
runtime 'org.springframework:spring-context-support'
|
||||
|
||||
integrationTestCompile project(':spring-security-cas'),
|
||||
"org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion",
|
||||
"org.gebish:geb-spock:$gebVersion",
|
||||
'commons-httpclient:commons-httpclient:3.1',
|
||||
"org.eclipse.jetty:jetty-server:$jettyVersion",
|
||||
"org.eclipse.jetty:jetty-servlet:$jettyVersion",
|
||||
"org.codehaus.groovy:groovy:$groovyVersion",
|
||||
"org.slf4j:jcl-over-slf4j:$slf4jVersion",
|
||||
spockDependencies
|
||||
integrationTestCompile project(':spring-security-cas')
|
||||
integrationTestCompile gebDependencies
|
||||
integrationTestCompile seleniumDependencies
|
||||
integrationTestCompile spockDependencies
|
||||
integrationTestCompile 'org.codehaus.groovy:groovy'
|
||||
integrationTestCompile 'org.eclipse.jetty:jetty-server'
|
||||
integrationTestCompile 'org.eclipse.jetty:jetty-servlet'
|
||||
integrationTestCompile 'org.slf4j:jcl-over-slf4j'
|
||||
}
|
||||
|
||||
[jettyRun, jettyRunWar]*.configure {
|
||||
contextPath = "/cas-sample"
|
||||
[project.tasks.jettyRun, project.tasks.jettyRunWar]*.configure {
|
||||
contextPath = '/cas-sample'
|
||||
def httpConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector').newInstance()
|
||||
httpConnector.port = 8080
|
||||
httpConnector.confidentialPort = 8443
|
||||
@@ -74,6 +70,7 @@ task cas (dependsOn: [jettyRunWar]) {
|
||||
task casServer(dependsOn: ':spring-security-samples-xml-casserver:casServer') {
|
||||
}
|
||||
|
||||
|
||||
integrationTest.dependsOn cas
|
||||
integrationTest.doFirst {
|
||||
def casServiceHost = jettyRunWar.httpsHost
|
||||
@@ -105,7 +102,7 @@ gradle.taskGraph.whenReady {graph ->
|
||||
if(graph.hasTask(integrationTest)) {
|
||||
tasks.getByPath(':spring-security-samples-xml-casserver:casServerOverlay').logLevel = 'ERROR'
|
||||
jettyRunWar {
|
||||
additionalRuntimeJars += file("src/integration-test/resources")
|
||||
additionalRuntimeJars += file('src/integration-test/resources')
|
||||
daemon = true
|
||||
}
|
||||
|
||||
+35
-13
@@ -13,23 +13,25 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.security.samples.cas;
|
||||
package org.springframework.security.samples.cas
|
||||
|
||||
import java.io.IOException
|
||||
import org.eclipse.jetty.http.HttpVersion
|
||||
import org.eclipse.jetty.server.HttpConfiguration
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer
|
||||
import org.eclipse.jetty.server.ServerConnector
|
||||
import org.eclipse.jetty.server.SslConnectionFactory
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
import javax.servlet.ServletException
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
import javax.servlet.http.HttpServletResponse
|
||||
|
||||
import org.apache.commons.httpclient.HttpClient
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.eclipse.jetty.server.Request
|
||||
import org.eclipse.jetty.server.Server
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler
|
||||
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector
|
||||
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
|
||||
import org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl;
|
||||
import org.jasig.cas.client.validation.Assertion
|
||||
import org.jasig.cas.client.validation.Cas20ProxyTicketValidator;
|
||||
|
||||
/**
|
||||
@@ -54,6 +56,7 @@ class JettyCasService extends Server {
|
||||
* @return
|
||||
*/
|
||||
def init(String casServerUrl) {
|
||||
println "Initializing to " + casServerUrl
|
||||
ProxyGrantingTicketStorage storage = new ProxyGrantingTicketStorageImpl()
|
||||
validator = new Cas20ProxyTicketValidator(casServerUrl)
|
||||
validator.setAcceptAnyProxy(true)
|
||||
@@ -61,12 +64,31 @@ class JettyCasService extends Server {
|
||||
validator.setProxyCallbackUrl(absoluteUrl('callback'))
|
||||
|
||||
String password = System.getProperty('javax.net.ssl.trustStorePassword','password')
|
||||
SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector()
|
||||
ssl_connector.setPort(port)
|
||||
ssl_connector.setKeystore(getTrustStore())
|
||||
ssl_connector.setPassword(password)
|
||||
ssl_connector.setKeyPassword(password)
|
||||
addConnector(ssl_connector)
|
||||
|
||||
|
||||
SslContextFactory sslContextFactory = new SslContextFactory();
|
||||
sslContextFactory.setKeyStorePath(getTrustStore());
|
||||
sslContextFactory.setKeyStorePassword(password);
|
||||
sslContextFactory.setKeyManagerPassword(password);
|
||||
|
||||
HttpConfiguration http_config = new HttpConfiguration();
|
||||
http_config.setSecureScheme("https");
|
||||
http_config.setSecurePort(availablePort());
|
||||
http_config.setOutputBufferSize(32768);
|
||||
|
||||
HttpConfiguration https_config = new HttpConfiguration(http_config);
|
||||
SecureRequestCustomizer src = new SecureRequestCustomizer();
|
||||
src.setStsMaxAge(2000);
|
||||
src.setStsIncludeSubDomains(true);
|
||||
https_config.addCustomizer(src);
|
||||
|
||||
ServerConnector https = new ServerConnector(this,
|
||||
new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
|
||||
new HttpConnectionFactory(https_config));
|
||||
https.setPort(port);
|
||||
https.setIdleTimeout(500000);
|
||||
|
||||
addConnector(https)
|
||||
setHandler(new AbstractHandler() {
|
||||
public void handle(String target, Request baseRequest,
|
||||
HttpServletRequest request, HttpServletResponse response)
|
||||
@@ -121,4 +143,4 @@ class JettyCasService extends Server {
|
||||
server.close()
|
||||
port
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
apply plugin: 'jetty'
|
||||
apply plugin: 'io.spring.convention.spring-sample'
|
||||
|
||||
def keystore = "$rootDir/samples/certificates/server.jks"
|
||||
def password = 'password'
|
||||
Reference in New Issue
Block a user