This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-wss4j.git


The following commit(s) were added to refs/heads/master by this push:
     new ac27c7e  WSS-678 OpenSAML Decrypter initialization failed (#14)
ac27c7e is described below

commit ac27c7eecb5dacdd502e94a34650ba524b7bb353
Author: Alexey Markevich <[email protected]>
AuthorDate: Wed Sep 16 12:35:11 2020 +0300

    WSS-678 OpenSAML Decrypter initialization failed (#14)
---
 .../org/apache/wss4j/common/saml/OpenSAMLUtil.java |  5 +++
 .../apache/wss4j/common/saml/OpenSAMLUtilTest.java | 37 ++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git 
a/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
 
b/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
index ef609d3..f68074f 100644
--- 
a/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
+++ 
b/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
@@ -43,6 +43,7 @@ import org.opensaml.core.xml.io.UnmarshallerFactory;
 import org.opensaml.core.xml.io.UnmarshallingException;
 import org.opensaml.saml.common.SignableSAMLObject;
 import org.opensaml.saml.config.SAMLConfiguration;
+import org.opensaml.xmlsec.config.DecryptionParserPool;
 import org.opensaml.xmlsec.signature.Signature;
 import org.opensaml.xmlsec.signature.support.SignatureException;
 import org.opensaml.xmlsec.signature.support.Signer;
@@ -101,6 +102,10 @@ public final class OpenSAMLUtil {
 
                 try {
                     configureParserPool();
+
+                    // used by org.opensaml.saml.saml2.encryption.Decrypter
+                    configuration.register(DecryptionParserPool.class, new 
DecryptionParserPool(getParserPool()),
+                        ConfigurationService.DEFAULT_PARTITION_NAME);
                 } catch (Throwable t) {
                     LOG.warn("Unable to bootstrap the parser pool part of the 
opensaml library "
                              + "- some SAML operations may fail", t);
diff --git 
a/ws-security-common/src/test/java/org/apache/wss4j/common/saml/OpenSAMLUtilTest.java
 
b/ws-security-common/src/test/java/org/apache/wss4j/common/saml/OpenSAMLUtilTest.java
new file mode 100644
index 0000000..8cc20b2
--- /dev/null
+++ 
b/ws-security-common/src/test/java/org/apache/wss4j/common/saml/OpenSAMLUtilTest.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wss4j.common.saml;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Some tests for the Merlin Crypto provider
+ */
+public class OpenSAMLUtilTest {
+
+    @Test
+    public void testInitSamlEngine() throws Exception {
+        OpenSAMLUtil.initSamlEngine();
+
+        // https://issues.apache.org/jira/browse/WSS-678 OpenSAML Decrypter 
initialization failed
+        new org.opensaml.saml.saml2.encryption.Decrypter(null, null, null);
+    }
+
+}
\ No newline at end of file

Reply via email to