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);
}

View file

@ -1,6 +1,6 @@
Name: voms-api-java
Version: 3.2.0
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Virtual Organization Membership Service Java API
License: ASL 2.0
@ -8,14 +8,16 @@ URL: https://wiki.italiangrid.it/VOMS
Source0: https://github.com/italiangrid/%{name}/archive/v%{version}.tar.gz
# Disable tests using non-local network interface
Patch0: %{name}-no-local.patch
# Adapt to canl-java version 2.5
Patch1: %{name}-canl-2.5.patch
BuildArch: noarch
BuildRequires: maven-local
BuildRequires: mvn(eu.eu-emi.security:canl)
BuildRequires: mvn(eu.eu-emi.security:canl) >= 2.5
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.mockito:mockito-core)
BuildRequires: mvn(com.mycila.maven-license-plugin:maven-license-plugin)
BuildRequires: mvn(net.jcip:jcip-annotations)
Requires: mvn(eu.eu-emi.security:canl) >= 2.5
%description
The Virtual Organization Membership Service (VOMS) is an attribute authority
@ -36,20 +38,25 @@ Virtual Organization Membership Service (VOMS) Java API Documentation.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
# Do not create source jars
%pom_remove_plugin org.apache.maven.plugins:maven-source-plugin
# Cobertura no longer in Fedora due to licensing issues
%pom_remove_plugin org.codehaus.mojo:cobertura-maven-plugin
%pom_xpath_inject "pom:project/pom:build/pom:plugins/pom:plugin[pom:groupId='com.mycila.maven-license-plugin']/pom:configuration/pom:excludes" "<exclude>.xmvn/**</exclude>"
%pom_xpath_remove "pom:project/pom:build/pom:plugins/pom:plugin[pom:groupId='com.mycila.maven-license-plugin']/pom:configuration/pom:strictCheck"
# Remove license plugin
%pom_remove_plugin com.mycila.maven-license-plugin:maven-license-plugin
%build
%mvn_build
%install
%mvn_install
%mvn_install -J target/site/javadoc/apidocs
%files -f .mfiles
%dir %{_javadir}/%{name}
%doc AUTHORS README.md
%license LICENSE
@ -57,6 +64,10 @@ Virtual Organization Membership Service (VOMS) Java API Documentation.
%license LICENSE
%changelog
* Fri Jan 05 2018 Mattias Ellert <mattias.ellert@physics.uu.se> - 3.2.0-5
- Adapt to canl-java 2.5
- Use jcip-annotations for EPEL 7 build
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
@ -70,6 +81,10 @@ Virtual Organization Membership Service (VOMS) Java API Documentation.
- Update to version 3.2.0 - matches canl-java 2.2.x
- Drop patches: voms-api-java-bc147.patch, -javadoc.patch and -testfix.patch
* Sun Feb 14 2016 Mattias Ellert <mattias.ellert@fysast.uu.se> - 3.1.0-1
- Update to version 3.1.0 - matches canl-java 2.1.x
- Drop patches: voms-api-java-bc147.patch and -javadoc.patch
* Thu Feb 11 2016 Mattias Ellert <mattias.ellert@fysast.uu.se> - 3.0.5-5
- Backport fix for failing test due to new canl-java version