Adapt to canl-java 2.5

Use jcip-annotations for EPEL 7 build
This commit is contained in:
Mattias Ellert 2018-01-05 11:38:47 +01:00
commit 397f73a1c4
2 changed files with 218 additions and 6 deletions

View file

@ -0,0 +1,197 @@
diff -ur voms-api-java-3.2.0.orig/src/main/java/org/italiangrid/voms/credential/impl/AbstractLoadCredentialsStrategy.java voms-api-java-3.2.0/src/main/java/org/italiangrid/voms/credential/impl/AbstractLoadCredentialsStrategy.java
--- voms-api-java-3.2.0.orig/src/main/java/org/italiangrid/voms/credential/impl/AbstractLoadCredentialsStrategy.java 2016-02-11 16:57:01.000000000 +0100
+++ voms-api-java-3.2.0/src/main/java/org/italiangrid/voms/credential/impl/AbstractLoadCredentialsStrategy.java 2018-01-05 12:30:30.853119209 +0100
@@ -19,7 +19,7 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import org.bouncycastle.openssl.PasswordFinder;
+import eu.emi.security.authn.x509.helpers.PasswordSupplier;
import org.italiangrid.voms.credential.LoadCredentialsEventListener;
import org.italiangrid.voms.credential.LoadCredentialsStrategy;
import org.italiangrid.voms.credential.VOMSEnvironmentVariables;
@@ -83,13 +83,13 @@
* @param certificatePath
* the path to the certificate
* @param pf
- * a {@link PasswordFinder} used to resolve the private key password
+ * a {@link PasswordSupplier} used to resolve the private key password
* when needed
* @return the loaded {@link X509Credential}, or <code>null</code> if the
* credential couldn't be loaded
*/
protected X509Credential loadPEMCredential(String privateKeyPath,
- String certificatePath, PasswordFinder pf) {
+ String certificatePath, PasswordSupplier pf) {
PEMCredential cred = null;
@@ -120,12 +120,12 @@
* @param pkcs12FilePath
* the path to the pkcs12 credential
* @param pf
- * a {@link PasswordFinder} used to resolve the private key password
+ * a {@link PasswordSupplier} used to resolve the private key password
* @return the loaded {@link X509Credential}, or <code>null</code> if the
* credential couldn't be loaded
*/
protected X509Credential loadPKCS12Credential(String pkcs12FilePath,
- PasswordFinder pf) {
+ PasswordSupplier pf) {
KeystoreCredential cred = null;
diff -ur voms-api-java-3.2.0.orig/src/main/java/org/italiangrid/voms/credential/impl/DefaultLoadCredentialsStrategy.java voms-api-java-3.2.0/src/main/java/org/italiangrid/voms/credential/impl/DefaultLoadCredentialsStrategy.java
--- voms-api-java-3.2.0.orig/src/main/java/org/italiangrid/voms/credential/impl/DefaultLoadCredentialsStrategy.java 2016-02-11 16:57:01.000000000 +0100
+++ voms-api-java-3.2.0/src/main/java/org/italiangrid/voms/credential/impl/DefaultLoadCredentialsStrategy.java 2018-01-05 12:30:30.854119198 +0100
@@ -15,7 +15,7 @@
*/
package org.italiangrid.voms.credential.impl;
-import org.bouncycastle.openssl.PasswordFinder;
+import eu.emi.security.authn.x509.helpers.PasswordSupplier;
import org.italiangrid.voms.VOMSError;
import org.italiangrid.voms.credential.LoadCredentialsEventListener;
import org.italiangrid.voms.credential.ProxyNamingPolicy;
@@ -115,7 +115,7 @@
return val;
}
- public X509Credential loadCredentials(PasswordFinder pf) {
+ public X509Credential loadCredentials(PasswordSupplier pf) {
if (pf == null)
throw new IllegalArgumentException(
@@ -163,7 +163,7 @@
return null;
}
- protected X509Credential loadPEMCredentialFromEnv(PasswordFinder pf) {
+ protected X509Credential loadPEMCredentialFromEnv(PasswordSupplier pf) {
String certPath = getFromEnvOrSystemProperty(X509_USER_CERT);
String keyPath = getFromEnvOrSystemProperty(X509_USER_KEY);
@@ -175,7 +175,7 @@
return null;
}
- protected X509Credential loadPKCS12CredentialFromEnv(PasswordFinder pf) {
+ protected X509Credential loadPKCS12CredentialFromEnv(PasswordSupplier pf) {
String pkcs12Path = getFromEnvOrSystemProperty(PKCS12_USER_CERT);
@@ -185,7 +185,7 @@
return null;
}
- protected X509Credential loadPKCS12CredentialsFromGlobusDir(PasswordFinder pf) {
+ protected X509Credential loadPKCS12CredentialsFromGlobusDir(PasswordSupplier pf) {
String credPath = String.format("%s/%s", home,
GLOBUS_PKCS12_CRED_PATH_SUFFIX);
@@ -193,7 +193,7 @@
}
- protected X509Credential loadPEMCredentialsFromGlobusDir(PasswordFinder pf) {
+ protected X509Credential loadPEMCredentialsFromGlobusDir(PasswordSupplier pf) {
String certPath = String.format("%s/%s", home, GLOBUS_PEM_CERT_PATH_SUFFIX);
String keyPath = String.format("%s/%s", home, GLOBUS_PEM_KEY_PATH_SUFFIX);
diff -ur voms-api-java-3.2.0.orig/src/main/java/org/italiangrid/voms/credential/LoadCredentialsStrategy.java voms-api-java-3.2.0/src/main/java/org/italiangrid/voms/credential/LoadCredentialsStrategy.java
--- voms-api-java-3.2.0.orig/src/main/java/org/italiangrid/voms/credential/LoadCredentialsStrategy.java 2016-02-11 16:57:01.000000000 +0100
+++ voms-api-java-3.2.0/src/main/java/org/italiangrid/voms/credential/LoadCredentialsStrategy.java 2018-01-05 12:30:30.852119219 +0100
@@ -15,7 +15,7 @@
*/
package org.italiangrid.voms.credential;
-import org.bouncycastle.openssl.PasswordFinder;
+import eu.emi.security.authn.x509.helpers.PasswordSupplier;
import eu.emi.security.authn.x509.X509Credential;
@@ -37,5 +37,5 @@
* @return an {@link X509Credential}, or <code>null</code> if no credential
* was found
*/
- public X509Credential loadCredentials(PasswordFinder passwordFinder);
+ public X509Credential loadCredentials(PasswordSupplier passwordFinder);
}
diff -ur voms-api-java-3.2.0.orig/src/main/java/org/italiangrid/voms/credential/UserCredentials.java voms-api-java-3.2.0/src/main/java/org/italiangrid/voms/credential/UserCredentials.java
--- voms-api-java-3.2.0.orig/src/main/java/org/italiangrid/voms/credential/UserCredentials.java 2016-02-11 16:57:01.000000000 +0100
+++ voms-api-java-3.2.0/src/main/java/org/italiangrid/voms/credential/UserCredentials.java 2018-01-05 12:30:30.852119219 +0100
@@ -15,7 +15,7 @@
*/
package org.italiangrid.voms.credential;
-import org.bouncycastle.openssl.PasswordFinder;
+import eu.emi.security.authn.x509.helpers.PasswordSupplier;
import org.italiangrid.voms.credential.impl.DefaultLoadCredentialsStrategy;
import eu.emi.security.authn.x509.X509Credential;
@@ -43,7 +43,7 @@
public static X509Credential loadCredentials(final char[] keyPassword) {
- PasswordFinder pf = new PasswordFinder() {
+ PasswordSupplier pf = new PasswordSupplier() {
public char[] getPassword() {
@@ -54,7 +54,7 @@
return loadCredentialsStrategy.loadCredentials(pf);
}
- public static X509Credential loadCredentials(PasswordFinder passwordFinder) {
+ public static X509Credential loadCredentials(PasswordSupplier passwordFinder) {
return loadCredentialsStrategy.loadCredentials(passwordFinder);
}
diff -ur voms-api-java-3.2.0.orig/src/test/java/org/italiangrid/voms/test/cred/TestLoadCredential.java voms-api-java-3.2.0/src/test/java/org/italiangrid/voms/test/cred/TestLoadCredential.java
--- voms-api-java-3.2.0.orig/src/test/java/org/italiangrid/voms/test/cred/TestLoadCredential.java 2016-02-11 16:57:01.000000000 +0100
+++ voms-api-java-3.2.0/src/test/java/org/italiangrid/voms/test/cred/TestLoadCredential.java 2018-01-05 12:30:30.852119219 +0100
@@ -15,7 +15,7 @@
*/
package org.italiangrid.voms.test.cred;
-import org.bouncycastle.openssl.PasswordFinder;
+import eu.emi.security.authn.x509.helpers.PasswordSupplier;
import org.italiangrid.voms.credential.impl.AbstractLoadCredentialsStrategy;
import org.italiangrid.voms.credential.impl.DefaultLoadCredentialsStrategy;
import org.italiangrid.voms.util.FilePermissionHelper;
@@ -51,7 +51,7 @@
+ "/.globus/usercred.p12");
}
- static class TestPasswordFinder implements PasswordFinder {
+ static class TestPasswordFinder implements PasswordSupplier {
public char[] getPassword() {
@@ -59,7 +59,7 @@
}
}
- static class NullPasswordFinder implements PasswordFinder {
+ static class NullPasswordSupplier implements PasswordSupplier {
public char[] getPassword() {
@@ -72,7 +72,7 @@
AbstractLoadCredentialsStrategy strategy = new DefaultLoadCredentialsStrategy(
emptyHome);
- X509Credential cred = strategy.loadCredentials(new NullPasswordFinder());
+ X509Credential cred = strategy.loadCredentials(new NullPasswordSupplier());
Assert.assertNull(cred);
}
@@ -81,7 +81,7 @@
AbstractLoadCredentialsStrategy strategy = new DefaultLoadCredentialsStrategy(
emptyGlobusHome);
- X509Credential cred = strategy.loadCredentials(new NullPasswordFinder());
+ X509Credential cred = strategy.loadCredentials(new NullPasswordSupplier());
Assert.assertNull(cred);
}