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 {
 | 
			
		||||
    @InputFile
 | 
			
		||||
    @Optional
 | 
			
		||||
    File manifestTemplate
 | 
			
		||||
 | 
			
		||||
    @OutputDirectory
 | 
			
		||||
| 
						 | 
				
			
			@ -69,13 +70,26 @@ public class Bundlor extends DefaultTask {
 | 
			
		|||
 | 
			
		||||
    Bundlor() {
 | 
			
		||||
        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)
 | 
			
		||||
 | 
			
		||||
        if (manifestTemplate != null) {
 | 
			
		||||
            project.jar.manifest.from manifest
 | 
			
		||||
            project.jar.inputs.files manifest
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @TaskAction
 | 
			
		||||
    void createManifest() {
 | 
			
		||||
        if (manifestTemplate == null) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        logging.captureStandardOutput(LogLevel.INFO)
 | 
			
		||||
 | 
			
		||||
        project.mkdir(bundlorDir)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,9 @@
 | 
			
		|||
// 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 {
 | 
			
		||||
    compile 'aopalliance:aopalliance:1.0',
 | 
			
		||||
            "net.sf.ehcache:ehcache:$ehcacheVersion",
 | 
			
		||||
| 
						 | 
				
			
			@ -20,16 +24,22 @@ dependencies {
 | 
			
		|||
                "cglib:cglib-nodep:$cglibVersion"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// jdkVersion = System.properties['java.version']
 | 
			
		||||
// isJdk6 = jdkVersion >= '1.6'
 | 
			
		||||
int maxAESKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength('AES')
 | 
			
		||||
compileJava.dependsOn cryptoProject.compileJava
 | 
			
		||||
classes.dependsOn cryptoProject.classes
 | 
			
		||||
 | 
			
		||||
classes.doLast {
 | 
			
		||||
    copy {
 | 
			
		||||
        from cryptoClasses
 | 
			
		||||
        into sourceSets.main.classesDir
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sourceSets.main.compileClasspath += cryptoClasses
 | 
			
		||||
sourceSets.test.compileClasspath += cryptoClasses
 | 
			
		||||
 | 
			
		||||
sourceJar.from cryptoProject.sourceSets.main.java
 | 
			
		||||
 | 
			
		||||
test {
 | 
			
		||||
    systemProperties['springSecurityVersion'] = version
 | 
			
		||||
    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',
 | 
			
		||||
    'openid',
 | 
			
		||||
    'taglibs',
 | 
			
		||||
    'aspects'
 | 
			
		||||
    'aspects',
 | 
			
		||||
    'crypto'
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
def String[] samples = [
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue