SEC-1689: Re-instate crypto as separate library (for use in non-Spring Security apps), as well as packaging with core.
This commit is contained in:
parent
ecfffaaa3f
commit
e27f655e9d
|
@ -45,6 +45,7 @@ class BundlorPlugin implements Plugin<Project> {
|
||||||
|
|
||||||
public class Bundlor extends DefaultTask {
|
public class Bundlor extends DefaultTask {
|
||||||
@InputFile
|
@InputFile
|
||||||
|
@Optional
|
||||||
File manifestTemplate
|
File manifestTemplate
|
||||||
|
|
||||||
@OutputDirectory
|
@OutputDirectory
|
||||||
|
@ -69,13 +70,26 @@ public class Bundlor extends DefaultTask {
|
||||||
|
|
||||||
Bundlor() {
|
Bundlor() {
|
||||||
manifestTemplate = new File(project.projectDir, 'template.mf')
|
manifestTemplate = new File(project.projectDir, 'template.mf')
|
||||||
|
|
||||||
|
if (!manifestTemplate.exists()) {
|
||||||
|
logger.info("No bundlor template for project " + project.name)
|
||||||
|
manifestTemplate = null
|
||||||
|
}
|
||||||
|
|
||||||
inputPaths = project.files(project.sourceSets.main.classesDir)
|
inputPaths = project.files(project.sourceSets.main.classesDir)
|
||||||
|
|
||||||
|
if (manifestTemplate != null) {
|
||||||
project.jar.manifest.from manifest
|
project.jar.manifest.from manifest
|
||||||
project.jar.inputs.files manifest
|
project.jar.inputs.files manifest
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
void createManifest() {
|
void createManifest() {
|
||||||
|
if (manifestTemplate == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
logging.captureStandardOutput(LogLevel.INFO)
|
logging.captureStandardOutput(LogLevel.INFO)
|
||||||
|
|
||||||
project.mkdir(bundlorDir)
|
project.mkdir(bundlorDir)
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
// Core build file
|
// Core build file
|
||||||
|
|
||||||
|
// We don't define a module dependency on crypto to avoid creating a transitive dependency
|
||||||
|
def cryptoProject = project(':spring-security-crypto')
|
||||||
|
def cryptoClasses = cryptoProject.sourceSets.main.classes
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'aopalliance:aopalliance:1.0',
|
compile 'aopalliance:aopalliance:1.0',
|
||||||
"net.sf.ehcache:ehcache:$ehcacheVersion",
|
"net.sf.ehcache:ehcache:$ehcacheVersion",
|
||||||
|
@ -20,16 +24,22 @@ dependencies {
|
||||||
"cglib:cglib-nodep:$cglibVersion"
|
"cglib:cglib-nodep:$cglibVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
// jdkVersion = System.properties['java.version']
|
compileJava.dependsOn cryptoProject.compileJava
|
||||||
// isJdk6 = jdkVersion >= '1.6'
|
classes.dependsOn cryptoProject.classes
|
||||||
int maxAESKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength('AES')
|
|
||||||
|
classes.doLast {
|
||||||
|
copy {
|
||||||
|
from cryptoClasses
|
||||||
|
into sourceSets.main.classesDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.main.compileClasspath += cryptoClasses
|
||||||
|
sourceSets.test.compileClasspath += cryptoClasses
|
||||||
|
|
||||||
|
sourceJar.from cryptoProject.sourceSets.main.java
|
||||||
|
|
||||||
test {
|
test {
|
||||||
systemProperties['springSecurityVersion'] = version
|
systemProperties['springSecurityVersion'] = version
|
||||||
systemProperties['springVersion'] = springVersion
|
systemProperties['springVersion'] = springVersion
|
||||||
|
|
||||||
if (maxAESKeySize < 256) {
|
|
||||||
logger.warn("AES keysize limited to $maxAESKeySize, skipping EncryptorsTests")
|
|
||||||
exclude '**/EncryptorsTests.class'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// crypto module build file
|
||||||
|
|
||||||
|
// jdkVersion = System.properties['java.version']
|
||||||
|
// isJdk6 = jdkVersion >= '1.6'
|
||||||
|
int maxAESKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength('AES')
|
||||||
|
|
||||||
|
test {
|
||||||
|
if (maxAESKeySize < 256) {
|
||||||
|
println "AES keysize limited to $maxAESKeySize, skipping EncryptorsTests"
|
||||||
|
exclude '**/EncryptorsTests.class'
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ def String[] modules = [
|
||||||
'cas',
|
'cas',
|
||||||
'openid',
|
'openid',
|
||||||
'taglibs',
|
'taglibs',
|
||||||
'aspects'
|
'aspects',
|
||||||
|
'crypto'
|
||||||
]
|
]
|
||||||
|
|
||||||
def String[] samples = [
|
def String[] samples = [
|
||||||
|
|
Loading…
Reference in New Issue