You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2015/02/12 13:11:03 UTC
svn commit: r1659234 [1/2] - in /webservices/wss4j/trunk: ./ bindings/
integration/ parent/ policy/ ws-security-common/
ws-security-common/src/main/java/org/apache/wss4j/common/saml/
ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder...
Author: coheigea
Date: Thu Feb 12 12:11:02 2015
New Revision: 1659234
URL: http://svn.apache.org/r1659234
Log:
Updating trunk to use Opensaml 3.0
Removed:
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLBootstrap.java
Modified:
webservices/wss4j/trunk/bindings/pom.xml
webservices/wss4j/trunk/integration/pom.xml
webservices/wss4j/trunk/parent/pom.xml
webservices/wss4j/trunk/policy/pom.xml
webservices/wss4j/trunk/pom.xml
webservices/wss4j/trunk/ws-security-common/pom.xml
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML1ComponentBuilder.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java
webservices/wss4j/trunk/ws-security-dom/pom.xml
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SamlAssertionValidator.java
webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomSamlAssertionValidator.java
webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java
webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java
webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java
webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java
webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java
webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java
webservices/wss4j/trunk/ws-security-policy-stax/pom.xml
webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/IssuedTokenAssertionState.java
webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/SamlTokenAssertionState.java
webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java
webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/IssuedTokenTest.java
webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SamlTokenTest.java
webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java
webservices/wss4j/trunk/ws-security-stax/pom.xml
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SamlSecurityTokenImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SamlTokenValidatorImpl.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/InboundWSSecurityContextImplTest.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLCallbackHandlerImpl.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenHOKTest.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenReferenceTest.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenSVTest.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SAMLTokenTest.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/saml/SamlConditionsTest.java
Modified: webservices/wss4j/trunk/bindings/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/bindings/pom.xml?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/bindings/pom.xml (original)
+++ webservices/wss4j/trunk/bindings/pom.xml Thu Feb 12 12:11:02 2015
@@ -21,14 +21,14 @@
<parent>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-parent</artifactId>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-bindings</artifactId>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<name>Apache WSS4J WS-Security Bindings</name>
<properties>
Modified: webservices/wss4j/trunk/integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/integration/pom.xml?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/integration/pom.xml (original)
+++ webservices/wss4j/trunk/integration/pom.xml Thu Feb 12 12:11:02 2015
@@ -23,11 +23,11 @@
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-parent</artifactId>
<relativePath>../parent/pom.xml</relativePath>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.wss4j</groupId>
<artifactId>integration</artifactId>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<name>Apache WSS4J WS-Security Integration</name>
<build>
Modified: webservices/wss4j/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/parent/pom.xml?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/parent/pom.xml (original)
+++ webservices/wss4j/trunk/parent/pom.xml Thu Feb 12 12:11:02 2015
@@ -23,11 +23,11 @@
<parent>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j</artifactId>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-parent</artifactId>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache WSS4J parent</name>
<description>Apache WSS4J parent pom</description>
@@ -43,7 +43,7 @@
<junit.version>4.12</junit.version>
<log4j.version>1.2.17</log4j.version>
<neethi.version>3.0.3</neethi.version>
- <opensaml.version>2.6.1</opensaml.version>
+ <opensaml.version>3.0.0</opensaml.version>
<slf4j.version>1.7.9</slf4j.version>
<woodstox.core.asl.version>4.4.1</woodstox.core.asl.version>
<wsdl4j.version>1.6.3</wsdl4j.version>
@@ -89,11 +89,6 @@
<version>${woodstox.core.asl.version}</version>
</dependency>
<dependency>
- <groupId>org.opensaml</groupId>
- <artifactId>opensaml</artifactId>
- <version>${opensaml.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
<version>${geronimo.javamail.version}</version>
Modified: webservices/wss4j/trunk/policy/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/policy/pom.xml?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/policy/pom.xml (original)
+++ webservices/wss4j/trunk/policy/pom.xml Thu Feb 12 12:11:02 2015
@@ -24,11 +24,11 @@
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-parent</artifactId>
<relativePath>../parent/pom.xml</relativePath>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-policy</artifactId>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<name>Apache WSS4J WS-SecurityPolicy model</name>
<dependencies>
Modified: webservices/wss4j/trunk/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/pom.xml?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/pom.xml (original)
+++ webservices/wss4j/trunk/pom.xml Thu Feb 12 12:11:02 2015
@@ -22,7 +22,7 @@
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j</artifactId>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache WSS4J</name>
<description>
@@ -108,7 +108,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <targetJdk>1.6</targetJdk>
+ <targetJdk>1.7</targetJdk>
</properties>
<modules>
@@ -381,6 +381,14 @@
<enabled>false</enabled>
</releases>
</repository>
+ <!-- needed for opensaml -->
+ <repository>
+ <id>shib-release</id>
+ <url>https://build.shibboleth.net/nexus/content/groups/public</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
</repositories>
<pluginRepositories>
<pluginRepository>
Modified: webservices/wss4j/trunk/ws-security-common/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/pom.xml?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/pom.xml (original)
+++ webservices/wss4j/trunk/ws-security-common/pom.xml Thu Feb 12 12:11:02 2015
@@ -23,12 +23,12 @@
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-parent</artifactId>
<relativePath>../parent/pom.xml</relativePath>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-ws-security-common</artifactId>
<name>Apache WSS4J WS-Security Common</name>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<properties>
<wss4j.osgi.import>
@@ -104,6 +104,19 @@
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
+ <artifactId>opensaml-saml-api</artifactId>
+ <version>${opensaml.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opensaml</groupId>
+ <artifactId>opensaml-saml-impl</artifactId>
+ <version>${opensaml.version}</version>
+ <scope>compile</scope>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
<scope>compile</scope>
<exclusions>
@@ -197,6 +210,7 @@
</exclusion>
</exclusions>
</dependency>
+-->
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-kerberos-codec</artifactId>
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java Thu Feb 12 12:11:02 2015
@@ -23,11 +23,21 @@ import javax.xml.namespace.QName;
import org.apache.wss4j.common.crypto.WSProviderConfig;
import org.apache.wss4j.common.ext.WSSecurityException;
-import org.opensaml.xml.*;
-import org.opensaml.xml.io.*;
-import org.opensaml.xml.signature.Signature;
-import org.opensaml.xml.signature.SignatureException;
-import org.opensaml.xml.signature.Signer;
+import org.opensaml.core.config.InitializationException;
+import org.opensaml.core.config.InitializationService;
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.XMLObjectBuilder;
+import org.opensaml.core.xml.XMLObjectBuilderFactory;
+import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
+import org.opensaml.core.xml.io.Marshaller;
+import org.opensaml.core.xml.io.MarshallerFactory;
+import org.opensaml.core.xml.io.MarshallingException;
+import org.opensaml.core.xml.io.Unmarshaller;
+import org.opensaml.core.xml.io.UnmarshallerFactory;
+import org.opensaml.core.xml.io.UnmarshallingException;
+import org.opensaml.xmlsec.signature.Signature;
+import org.opensaml.xmlsec.signature.support.SignatureException;
+import org.opensaml.xmlsec.signature.support.Signer;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
@@ -58,20 +68,21 @@ public final class OpenSAMLUtil {
}
try {
WSProviderConfig.init();
- OpenSAMLBootstrap.bootstrap();
- builderFactory = Configuration.getBuilderFactory();
- marshallerFactory = Configuration.getMarshallerFactory();
- unmarshallerFactory = Configuration.getUnmarshallerFactory();
+ InitializationService.initialize();
+ // OpenSAMLBootstrap.bootstrap();
+ builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();
+ marshallerFactory = XMLObjectProviderRegistrySupport.getMarshallerFactory();
+ unmarshallerFactory = XMLObjectProviderRegistrySupport.getUnmarshallerFactory();
samlEngineInitialized = true;
if (LOG.isDebugEnabled()) {
LOG.debug("opensaml2 library bootstrap complete");
}
- } catch (ConfigurationException e) {
+ } catch (InitializationException e) {
LOG.error(
"Unable to bootstrap the opensaml2 library - all SAML operations will fail",
e
);
- }
+ }
}
}
@@ -106,7 +117,6 @@ public final class OpenSAMLUtil {
* @param doc of type Document
* @return Element
* @throws MarshallingException
- * @throws SignatureException
*/
public static Element toDom(
XMLObject xmlObject,
@@ -123,7 +133,6 @@ public final class OpenSAMLUtil {
* @param signObject whether to sign the XMLObject during marshalling
* @return Element
* @throws MarshallingException
- * @throws SignatureException
*/
public static Element toDom(
XMLObject xmlObject,
@@ -164,49 +173,49 @@ public final class OpenSAMLUtil {
}
private static void signXMLObject(XMLObject xmlObject) throws WSSecurityException {
- if (xmlObject instanceof org.opensaml.saml1.core.Response) {
- org.opensaml.saml1.core.Response response =
- (org.opensaml.saml1.core.Response)xmlObject;
+ if (xmlObject instanceof org.opensaml.saml.saml1.core.Response) {
+ org.opensaml.saml.saml1.core.Response response =
+ (org.opensaml.saml.saml1.core.Response)xmlObject;
// Sign any Assertions
if (response.getAssertions() != null) {
- for (org.opensaml.saml1.core.Assertion assertion : response.getAssertions()) {
+ for (org.opensaml.saml.saml1.core.Assertion assertion : response.getAssertions()) {
signObject(assertion.getSignature());
}
}
signObject(response.getSignature());
- } else if (xmlObject instanceof org.opensaml.saml2.core.Response) {
- org.opensaml.saml2.core.Response response =
- (org.opensaml.saml2.core.Response)xmlObject;
+ } else if (xmlObject instanceof org.opensaml.saml.saml2.core.Response) {
+ org.opensaml.saml.saml2.core.Response response =
+ (org.opensaml.saml.saml2.core.Response)xmlObject;
// Sign any Assertions
if (response.getAssertions() != null) {
- for (org.opensaml.saml2.core.Assertion assertion : response.getAssertions()) {
+ for (org.opensaml.saml.saml2.core.Assertion assertion : response.getAssertions()) {
signObject(assertion.getSignature());
}
}
signObject(response.getSignature());
- } else if (xmlObject instanceof org.opensaml.saml2.core.Assertion) {
- org.opensaml.saml2.core.Assertion saml2 =
- (org.opensaml.saml2.core.Assertion) xmlObject;
+ } else if (xmlObject instanceof org.opensaml.saml.saml2.core.Assertion) {
+ org.opensaml.saml.saml2.core.Assertion saml2 =
+ (org.opensaml.saml.saml2.core.Assertion) xmlObject;
signObject(saml2.getSignature());
- } else if (xmlObject instanceof org.opensaml.saml1.core.Assertion) {
- org.opensaml.saml1.core.Assertion saml1 =
- (org.opensaml.saml1.core.Assertion) xmlObject;
+ } else if (xmlObject instanceof org.opensaml.saml.saml1.core.Assertion) {
+ org.opensaml.saml.saml1.core.Assertion saml1 =
+ (org.opensaml.saml.saml1.core.Assertion) xmlObject;
signObject(saml1.getSignature());
- } else if (xmlObject instanceof org.opensaml.saml2.core.RequestAbstractType) {
- org.opensaml.saml2.core.RequestAbstractType request =
- (org.opensaml.saml2.core.RequestAbstractType) xmlObject;
+ } else if (xmlObject instanceof org.opensaml.saml.saml2.core.RequestAbstractType) {
+ org.opensaml.saml.saml2.core.RequestAbstractType request =
+ (org.opensaml.saml.saml2.core.RequestAbstractType) xmlObject;
signObject(request.getSignature());
- } else if (xmlObject instanceof org.opensaml.saml1.core.Request) {
- org.opensaml.saml1.core.Request request =
- (org.opensaml.saml1.core.Request) xmlObject;
+ } else if (xmlObject instanceof org.opensaml.saml.saml1.core.Request) {
+ org.opensaml.saml.saml1.core.Request request =
+ (org.opensaml.saml.saml1.core.Request) xmlObject;
signObject(request.getSignature());
}
@@ -230,7 +239,8 @@ public final class OpenSAMLUtil {
@SuppressWarnings("unchecked")
public static Signature buildSignature() {
QName qName = Signature.DEFAULT_ELEMENT_NAME;
- XMLObjectBuilder<Signature> builder = builderFactory.getBuilder(qName);
+ XMLObjectBuilder<Signature> builder =
+ (XMLObjectBuilder<Signature>)builderFactory.getBuilder(qName);
if (builder == null) {
LOG.error(
"Unable to retrieve builder for object QName "
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java Thu Feb 12 12:11:02 2015
@@ -26,7 +26,7 @@ import org.apache.wss4j.common.saml.bean
import org.apache.wss4j.common.saml.bean.AuthenticationStatementBean;
import org.apache.wss4j.common.saml.bean.ConditionsBean;
import org.apache.wss4j.common.saml.bean.SubjectBean;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import org.w3c.dom.Element;
import javax.security.auth.callback.Callback;
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java Thu Feb 12 12:11:02 2015
@@ -40,7 +40,7 @@ import org.apache.wss4j.common.crypto.Cr
import org.apache.wss4j.common.ext.WSPasswordCallback;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.common.util.XMLUtils;
-import org.opensaml.saml2.core.SubjectConfirmationData;
+import org.opensaml.saml.saml2.core.SubjectConfirmationData;
import org.w3c.dom.Element;
/**
@@ -117,7 +117,7 @@ public final class SAMLUtil {
* @throws WSSecurityException
*/
public static SAMLKeyInfo getCredentialFromSubject(
- org.opensaml.saml1.core.Assertion assertion,
+ org.opensaml.saml.saml1.core.Assertion assertion,
SAMLKeyInfoProcessor keyInfoProcessor,
Crypto sigCrypto,
CallbackHandler callbackHandler
@@ -128,19 +128,19 @@ public final class SAMLUtil {
return new SAMLKeyInfo(key);
}
- for (org.opensaml.saml1.core.Statement stmt : assertion.getStatements()) {
- org.opensaml.saml1.core.Subject samlSubject = null;
- if (stmt instanceof org.opensaml.saml1.core.AttributeStatement) {
- org.opensaml.saml1.core.AttributeStatement attrStmt =
- (org.opensaml.saml1.core.AttributeStatement) stmt;
+ for (org.opensaml.saml.saml1.core.Statement stmt : assertion.getStatements()) {
+ org.opensaml.saml.saml1.core.Subject samlSubject = null;
+ if (stmt instanceof org.opensaml.saml.saml1.core.AttributeStatement) {
+ org.opensaml.saml.saml1.core.AttributeStatement attrStmt =
+ (org.opensaml.saml.saml1.core.AttributeStatement) stmt;
samlSubject = attrStmt.getSubject();
- } else if (stmt instanceof org.opensaml.saml1.core.AuthenticationStatement) {
- org.opensaml.saml1.core.AuthenticationStatement authStmt =
- (org.opensaml.saml1.core.AuthenticationStatement) stmt;
+ } else if (stmt instanceof org.opensaml.saml.saml1.core.AuthenticationStatement) {
+ org.opensaml.saml.saml1.core.AuthenticationStatement authStmt =
+ (org.opensaml.saml.saml1.core.AuthenticationStatement) stmt;
samlSubject = authStmt.getSubject();
} else {
- org.opensaml.saml1.core.AuthorizationDecisionStatement authzStmt =
- (org.opensaml.saml1.core.AuthorizationDecisionStatement)stmt;
+ org.opensaml.saml.saml1.core.AuthorizationDecisionStatement authzStmt =
+ (org.opensaml.saml.saml1.core.AuthorizationDecisionStatement)stmt;
samlSubject = authzStmt.getSubject();
}
@@ -170,7 +170,7 @@ public final class SAMLUtil {
* @throws WSSecurityException
*/
public static SAMLKeyInfo getCredentialFromSubject(
- org.opensaml.saml2.core.Assertion assertion,
+ org.opensaml.saml.saml2.core.Assertion assertion,
SAMLKeyInfoProcessor keyInfoProcessor,
Crypto sigCrypto,
CallbackHandler callbackHandler
@@ -181,11 +181,11 @@ public final class SAMLUtil {
return new SAMLKeyInfo(key);
}
- org.opensaml.saml2.core.Subject samlSubject = assertion.getSubject();
+ org.opensaml.saml.saml2.core.Subject samlSubject = assertion.getSubject();
if (samlSubject != null) {
- List<org.opensaml.saml2.core.SubjectConfirmation> subjectConfList =
+ List<org.opensaml.saml.saml2.core.SubjectConfirmation> subjectConfList =
samlSubject.getSubjectConfirmations();
- for (org.opensaml.saml2.core.SubjectConfirmation subjectConfirmation : subjectConfList) {
+ for (org.opensaml.saml.saml2.core.SubjectConfirmation subjectConfirmation : subjectConfList) {
SubjectConfirmationData subjConfData =
subjectConfirmation.getSubjectConfirmationData();
if (subjConfData != null) {
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java Thu Feb 12 12:11:02 2015
@@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.List;
import javax.security.auth.callback.CallbackHandler;
+import javax.xml.bind.ValidationException;
import org.apache.wss4j.common.crypto.Crypto;
import org.apache.wss4j.common.crypto.CryptoType;
@@ -38,30 +39,30 @@ import org.apache.xml.security.signature
import org.apache.xml.security.signature.XMLSignatureException;
import org.apache.xml.security.stax.impl.util.IDGenerator;
import org.joda.time.DateTime;
-import org.opensaml.common.SAMLVersion;
-import org.opensaml.common.SignableSAMLObject;
-import org.opensaml.common.impl.SAMLObjectContentReference;
-import org.opensaml.saml1.core.AttributeStatement;
-import org.opensaml.saml1.core.AuthenticationStatement;
-import org.opensaml.saml1.core.AuthorizationDecisionStatement;
-import org.opensaml.saml1.core.ConfirmationMethod;
-import org.opensaml.saml1.core.Statement;
-import org.opensaml.saml1.core.Subject;
-import org.opensaml.saml1.core.SubjectConfirmation;
-import org.opensaml.saml1.core.SubjectStatement;
-import org.opensaml.saml2.core.AuthnStatement;
-import org.opensaml.saml2.core.AuthzDecisionStatement;
-import org.opensaml.saml2.core.Issuer;
-import org.opensaml.security.SAMLSignatureProfileValidator;
-import org.opensaml.xml.XMLObject;
-import org.opensaml.xml.security.x509.BasicX509Credential;
-import org.opensaml.xml.security.x509.X509KeyInfoGeneratorFactory;
-import org.opensaml.xml.signature.KeyInfo;
-import org.opensaml.xml.signature.Signature;
-import org.opensaml.xml.signature.SignatureConstants;
-import org.opensaml.xml.signature.SignatureValidator;
-import org.opensaml.xml.validation.ValidationException;
-import org.opensaml.xml.validation.ValidatorSuite;
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.saml.common.SAMLObjectContentReference;
+import org.opensaml.saml.common.SAMLVersion;
+import org.opensaml.saml.common.SignableSAMLObject;
+import org.opensaml.saml.saml1.core.AttributeStatement;
+import org.opensaml.saml.saml1.core.AuthenticationStatement;
+import org.opensaml.saml.saml1.core.AuthorizationDecisionStatement;
+import org.opensaml.saml.saml1.core.ConfirmationMethod;
+import org.opensaml.saml.saml1.core.Statement;
+import org.opensaml.saml.saml1.core.Subject;
+import org.opensaml.saml.saml1.core.SubjectConfirmation;
+import org.opensaml.saml.saml1.core.SubjectStatement;
+import org.opensaml.saml.saml2.core.AuthnStatement;
+import org.opensaml.saml.saml2.core.AuthzDecisionStatement;
+import org.opensaml.saml.saml2.core.Issuer;
+import org.opensaml.saml.security.impl.SAMLSignatureProfileValidator;
+import org.opensaml.security.credential.BasicCredential;
+import org.opensaml.security.x509.BasicX509Credential;
+import org.opensaml.xmlsec.keyinfo.impl.X509KeyInfoGeneratorFactory;
+import org.opensaml.xmlsec.signature.KeyInfo;
+import org.opensaml.xmlsec.signature.Signature;
+import org.opensaml.xmlsec.signature.support.SignatureConstants;
+import org.opensaml.xmlsec.signature.support.SignatureException;
+import org.opensaml.xmlsec.signature.support.SignatureValidator;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -84,12 +85,12 @@ public class SamlAssertionWrapper {
/**
* Typed SAML v1.1 assertion
*/
- private org.opensaml.saml1.core.Assertion saml1 = null;
+ private org.opensaml.saml.saml1.core.Assertion saml1 = null;
/**
* Typed SAML v2.0 assertion
*/
- private org.opensaml.saml2.core.Assertion saml2 = null;
+ private org.opensaml.saml.saml2.core.Assertion saml2 = null;
/**
* Which SAML specification to use (currently, only v1.1 and v2.0 are supported)
@@ -154,7 +155,7 @@ public class SamlAssertionWrapper {
*
* @param saml2 of type Assertion
*/
- public SamlAssertionWrapper(org.opensaml.saml2.core.Assertion saml2) {
+ public SamlAssertionWrapper(org.opensaml.saml.saml2.core.Assertion saml2) {
this((XMLObject)saml2);
}
@@ -163,7 +164,7 @@ public class SamlAssertionWrapper {
*
* @param saml1 of type Assertion
*/
- public SamlAssertionWrapper(org.opensaml.saml1.core.Assertion saml1) {
+ public SamlAssertionWrapper(org.opensaml.saml.saml1.core.Assertion saml1) {
this((XMLObject)saml1);
}
@@ -179,11 +180,11 @@ public class SamlAssertionWrapper {
OpenSAMLUtil.initSamlEngine();
this.xmlObject = xmlObject;
- if (xmlObject instanceof org.opensaml.saml1.core.Assertion) {
- this.saml1 = (org.opensaml.saml1.core.Assertion) xmlObject;
+ if (xmlObject instanceof org.opensaml.saml.saml1.core.Assertion) {
+ this.saml1 = (org.opensaml.saml.saml1.core.Assertion) xmlObject;
samlVersion = SAMLVersion.VERSION_11;
- } else if (xmlObject instanceof org.opensaml.saml2.core.Assertion) {
- this.saml2 = (org.opensaml.saml2.core.Assertion) xmlObject;
+ } else if (xmlObject instanceof org.opensaml.saml.saml2.core.Assertion) {
+ this.saml2 = (org.opensaml.saml.saml2.core.Assertion) xmlObject;
samlVersion = SAMLVersion.VERSION_20;
} else {
LOG.error(
@@ -219,7 +220,7 @@ public class SamlAssertionWrapper {
*
* @return the saml1 (type Assertion) of this SamlAssertionWrapper object.
*/
- public org.opensaml.saml1.core.Assertion getSaml1() {
+ public org.opensaml.saml.saml1.core.Assertion getSaml1() {
return saml1;
}
@@ -228,7 +229,7 @@ public class SamlAssertionWrapper {
*
* @return the saml2 (type Assertion) of this SamlAssertionWrapper object.
*/
- public org.opensaml.saml2.core.Assertion getSaml2() {
+ public org.opensaml.saml.saml2.core.Assertion getSaml2() {
return saml2;
}
@@ -333,7 +334,7 @@ public class SamlAssertionWrapper {
*/
public String getSubjectName() {
if (saml2 != null) {
- org.opensaml.saml2.core.Subject subject = saml2.getSubject();
+ org.opensaml.saml.saml2.core.Subject subject = saml2.getSubject();
if (subject != null && subject.getNameID() != null) {
return subject.getNameID().getValue();
}
@@ -356,7 +357,7 @@ public class SamlAssertionWrapper {
}
}
if (samlSubject != null && samlSubject.getNameIdentifier() != null) {
- return samlSubject.getNameIdentifier().getNameIdentifier();
+ return samlSubject.getNameIdentifier().getValue();
}
}
LOG.error(
@@ -375,10 +376,10 @@ public class SamlAssertionWrapper {
public List<String> getConfirmationMethods() {
List<String> methods = new ArrayList<String>();
if (saml2 != null) {
- org.opensaml.saml2.core.Subject subject = saml2.getSubject();
- List<org.opensaml.saml2.core.SubjectConfirmation> confirmations =
+ org.opensaml.saml.saml2.core.Subject subject = saml2.getSubject();
+ List<org.opensaml.saml.saml2.core.SubjectConfirmation> confirmations =
subject.getSubjectConfirmations();
- for (org.opensaml.saml2.core.SubjectConfirmation confirmation : confirmations) {
+ for (org.opensaml.saml.saml2.core.SubjectConfirmation confirmation : confirmations) {
methods.add(confirmation.getMethod());
}
} else if (saml1 != null) {
@@ -555,9 +556,8 @@ public class SamlAssertionWrapper {
signature.setSignatureAlgorithm(sigAlgo);
- BasicX509Credential signingCredential = new BasicX509Credential();
- signingCredential.setEntityCertificate(issuerCerts[0]);
- signingCredential.setPrivateKey(privateKey);
+ BasicX509Credential signingCredential =
+ new BasicX509Credential(issuerCerts[0], privateKey);
signature.setSigningCredential(signingCredential);
@@ -571,7 +571,7 @@ public class SamlAssertionWrapper {
KeyInfo keyInfo = kiFactory.newInstance().generate(
signingCredential);
signature.setKeyInfo(keyInfo);
- } catch (org.opensaml.xml.security.SecurityException ex) {
+ } catch (org.opensaml.security.SecurityException ex) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex,
"Error generating KeyInfo from signing credential");
}
@@ -621,21 +621,20 @@ public class SamlAssertionWrapper {
);
}
- BasicX509Credential credential = new BasicX509Credential();
+ BasicCredential credential = null;
if (samlKeyInfo.getCerts() != null) {
- credential.setEntityCertificate(samlKeyInfo.getCerts()[0]);
+ credential = new BasicX509Credential(samlKeyInfo.getCerts()[0]);
} else if (samlKeyInfo.getPublicKey() != null) {
- credential.setPublicKey(samlKeyInfo.getPublicKey());
+ credential = new BasicCredential(samlKeyInfo.getPublicKey());
} else {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity",
"cannot get certificate or key"
);
}
- SignatureValidator sigValidator = new SignatureValidator(credential);
try {
- sigValidator.validate(sig);
- } catch (ValidationException ex) {
+ SignatureValidator.validate(sig, credential);
+ } catch (SignatureException ex) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
"empty", ex, "SAML signature validation failed");
}
@@ -656,7 +655,7 @@ public class SamlAssertionWrapper {
SAMLSignatureProfileValidator validator = new SAMLSignatureProfileValidator();
try {
validator.validate(sig);
- } catch (ValidationException ex) {
+ } catch (SignatureException ex) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
"empty", ex, "SAML signature validation failed");
}
@@ -863,16 +862,16 @@ public class SamlAssertionWrapper {
}
if (getSamlVersion().equals(SAMLVersion.VERSION_20) && getSaml2().getConditions() != null) {
- org.opensaml.saml2.core.Conditions conditions = getSaml2().getConditions();
+ org.opensaml.saml.saml2.core.Conditions conditions = getSaml2().getConditions();
if (conditions != null && conditions.getAudienceRestrictions() != null
&& !conditions.getAudienceRestrictions().isEmpty()) {
boolean foundAddress = false;
- for (org.opensaml.saml2.core.AudienceRestriction audienceRestriction
+ for (org.opensaml.saml.saml2.core.AudienceRestriction audienceRestriction
: conditions.getAudienceRestrictions()) {
if (audienceRestriction.getAudiences() != null) {
- List<org.opensaml.saml2.core.Audience> audiences =
+ List<org.opensaml.saml.saml2.core.Audience> audiences =
audienceRestriction.getAudiences();
- for (org.opensaml.saml2.core.Audience audience : audiences) {
+ for (org.opensaml.saml.saml2.core.Audience audience : audiences) {
String audienceURI = audience.getAudienceURI();
if (audienceRestrictions.contains(audienceURI)) {
foundAddress = true;
@@ -887,16 +886,16 @@ public class SamlAssertionWrapper {
}
}
} else if (getSamlVersion().equals(SAMLVersion.VERSION_11) && getSaml1().getConditions() != null) {
- org.opensaml.saml1.core.Conditions conditions = getSaml1().getConditions();
+ org.opensaml.saml.saml1.core.Conditions conditions = getSaml1().getConditions();
if (conditions != null && conditions.getAudienceRestrictionConditions() != null
&& !conditions.getAudienceRestrictionConditions().isEmpty()) {
boolean foundAddress = false;
- for (org.opensaml.saml1.core.AudienceRestrictionCondition audienceRestriction
+ for (org.opensaml.saml.saml1.core.AudienceRestrictionCondition audienceRestriction
: conditions.getAudienceRestrictionConditions()) {
if (audienceRestriction.getAudiences() != null) {
- List<org.opensaml.saml1.core.Audience> audiences =
+ List<org.opensaml.saml.saml1.core.Audience> audiences =
audienceRestriction.getAudiences();
- for (org.opensaml.saml1.core.Audience audience : audiences) {
+ for (org.opensaml.saml.saml1.core.Audience audience : audiences) {
String audienceURI = audience.getUri();
if (audienceRestrictions.contains(audienceURI)) {
foundAddress = true;
@@ -988,12 +987,13 @@ public class SamlAssertionWrapper {
if (validateSignatureAgainstProfile) {
validateSignatureAgainstProfile();
}
-
+ /*
+ * TODO
if (getSaml1() != null) {
ValidatorSuite schemaValidators =
- org.opensaml.Configuration.getValidatorSuite("saml1-schema-validator");
+ org.opensaml.core.config.Configuration.getValidatorSuite("saml1-schema-validator");
ValidatorSuite specValidators =
- org.opensaml.Configuration.getValidatorSuite("saml1-spec-validator");
+ org.opensaml.core.config.Configuration.getValidatorSuite("saml1-spec-validator");
try {
schemaValidators.validate(getSaml1());
specValidators.validate(getSaml1());
@@ -1005,9 +1005,9 @@ public class SamlAssertionWrapper {
}
} else if (getSaml2() != null) {
ValidatorSuite schemaValidators =
- org.opensaml.Configuration.getValidatorSuite("saml2-core-schema-validator");
+ org.opensaml.core.config.Configuration.getValidatorSuite("saml2-core-schema-validator");
ValidatorSuite specValidators =
- org.opensaml.Configuration.getValidatorSuite("saml2-core-spec-validator");
+ org.opensaml.core.config.Configuration.getValidatorSuite("saml2-core-spec-validator");
try {
schemaValidators.validate(getSaml2());
specValidators.validate(getSaml2());
@@ -1018,6 +1018,7 @@ public class SamlAssertionWrapper {
);
}
}
+ */
}
@@ -1026,11 +1027,11 @@ public class SamlAssertionWrapper {
*/
private void parseElement(Element element) throws WSSecurityException {
this.xmlObject = OpenSAMLUtil.fromDom(element);
- if (xmlObject instanceof org.opensaml.saml1.core.Assertion) {
- this.saml1 = (org.opensaml.saml1.core.Assertion) xmlObject;
+ if (xmlObject instanceof org.opensaml.saml.saml1.core.Assertion) {
+ this.saml1 = (org.opensaml.saml.saml1.core.Assertion) xmlObject;
samlVersion = SAMLVersion.VERSION_11;
- } else if (xmlObject instanceof org.opensaml.saml2.core.Assertion) {
- this.saml2 = (org.opensaml.saml2.core.Assertion) xmlObject;
+ } else if (xmlObject instanceof org.opensaml.saml.saml2.core.Assertion) {
+ this.saml2 = (org.opensaml.saml.saml2.core.Assertion) xmlObject;
samlVersion = SAMLVersion.VERSION_20;
} else {
LOG.error(
@@ -1081,16 +1082,16 @@ public class SamlAssertionWrapper {
saml1.getAuthorizationDecisionStatements().addAll(authDecisionStatements);
// Build the complete assertion
- org.opensaml.saml1.core.Conditions conditions =
+ org.opensaml.saml.saml1.core.Conditions conditions =
SAML1ComponentBuilder.createSamlv1Conditions(samlCallback.getConditions());
saml1.setConditions(conditions);
if (samlCallback.getAdvice() != null) {
- org.opensaml.saml1.core.Advice advice =
+ org.opensaml.saml.saml1.core.Advice advice =
SAML1ComponentBuilder.createAdvice(samlCallback.getAdvice());
saml1.setAdvice(advice);
}
- } catch (org.opensaml.xml.security.SecurityException ex) {
+ } catch (org.opensaml.security.SecurityException ex) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex,
"Error generating KeyInfo from signing credential"
);
@@ -1112,7 +1113,7 @@ public class SamlAssertionWrapper {
saml2.getAuthnStatements().addAll(authnStatements);
// Attribute statement(s)
- List<org.opensaml.saml2.core.AttributeStatement> attributeStatements =
+ List<org.opensaml.saml.saml2.core.AttributeStatement> attributeStatements =
SAML2ComponentBuilder.createAttributeStatement(
samlCallback.getAttributeStatementData()
);
@@ -1129,21 +1130,21 @@ public class SamlAssertionWrapper {
saml2.setIssuer(samlIssuer);
try {
- org.opensaml.saml2.core.Subject subject =
+ org.opensaml.saml.saml2.core.Subject subject =
SAML2ComponentBuilder.createSaml2Subject(samlCallback.getSubject());
saml2.setSubject(subject);
- } catch (org.opensaml.xml.security.SecurityException ex) {
+ } catch (org.opensaml.security.SecurityException ex) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex,
"Error generating KeyInfo from signing credential"
);
}
- org.opensaml.saml2.core.Conditions conditions =
+ org.opensaml.saml.saml2.core.Conditions conditions =
SAML2ComponentBuilder.createConditions(samlCallback.getConditions());
saml2.setConditions(conditions);
if (samlCallback.getAdvice() != null) {
- org.opensaml.saml2.core.Advice advice =
+ org.opensaml.saml.saml2.core.Advice advice =
SAML2ComponentBuilder.createAdvice(samlCallback.getAdvice());
saml2.setAdvice(advice);
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML1ComponentBuilder.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML1ComponentBuilder.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML1ComponentBuilder.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML1ComponentBuilder.java Thu Feb 12 12:11:02 2015
@@ -19,6 +19,9 @@
package org.apache.wss4j.common.saml.builder;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.common.saml.OpenSAMLUtil;
import org.apache.wss4j.common.saml.bean.ActionBean;
@@ -34,40 +37,38 @@ import org.apache.wss4j.common.saml.bean
import org.apache.wss4j.common.saml.bean.SubjectLocalityBean;
import org.apache.xml.security.stax.impl.util.IDGenerator;
import org.joda.time.DateTime;
-import org.opensaml.Configuration;
-import org.opensaml.common.SAMLObjectBuilder;
-import org.opensaml.common.SAMLVersion;
-import org.opensaml.saml1.core.Action;
-import org.opensaml.saml1.core.Advice;
-import org.opensaml.saml1.core.Assertion;
-import org.opensaml.saml1.core.AssertionIDReference;
-import org.opensaml.saml1.core.Attribute;
-import org.opensaml.saml1.core.AttributeStatement;
-import org.opensaml.saml1.core.AttributeValue;
-import org.opensaml.saml1.core.Audience;
-import org.opensaml.saml1.core.AudienceRestrictionCondition;
-import org.opensaml.saml1.core.AuthenticationStatement;
-import org.opensaml.saml1.core.AuthorizationDecisionStatement;
-import org.opensaml.saml1.core.Conditions;
-import org.opensaml.saml1.core.ConfirmationMethod;
-import org.opensaml.saml1.core.DecisionTypeEnumeration;
-import org.opensaml.saml1.core.Evidence;
-import org.opensaml.saml1.core.NameIdentifier;
-import org.opensaml.saml1.core.Subject;
-import org.opensaml.saml1.core.SubjectConfirmation;
-import org.opensaml.saml1.core.SubjectLocality;
-import org.opensaml.xml.XMLObject;
-import org.opensaml.xml.XMLObjectBuilderFactory;
-import org.opensaml.xml.schema.XSString;
-import org.opensaml.xml.schema.impl.XSStringBuilder;
-import org.opensaml.xml.security.x509.BasicX509Credential;
-import org.opensaml.xml.security.x509.X509KeyInfoGeneratorFactory;
-import org.opensaml.xml.signature.KeyInfo;
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.XMLObjectBuilderFactory;
+import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
+import org.opensaml.core.xml.schema.XSString;
+import org.opensaml.core.xml.schema.impl.XSStringBuilder;
+import org.opensaml.saml.common.SAMLObjectBuilder;
+import org.opensaml.saml.common.SAMLVersion;
+import org.opensaml.saml.saml1.core.Action;
+import org.opensaml.saml.saml1.core.Advice;
+import org.opensaml.saml.saml1.core.Assertion;
+import org.opensaml.saml.saml1.core.AssertionIDReference;
+import org.opensaml.saml.saml1.core.Attribute;
+import org.opensaml.saml.saml1.core.AttributeStatement;
+import org.opensaml.saml.saml1.core.AttributeValue;
+import org.opensaml.saml.saml1.core.Audience;
+import org.opensaml.saml.saml1.core.AudienceRestrictionCondition;
+import org.opensaml.saml.saml1.core.AuthenticationStatement;
+import org.opensaml.saml.saml1.core.AuthorizationDecisionStatement;
+import org.opensaml.saml.saml1.core.Conditions;
+import org.opensaml.saml.saml1.core.ConfirmationMethod;
+import org.opensaml.saml.saml1.core.DecisionTypeEnumeration;
+import org.opensaml.saml.saml1.core.Evidence;
+import org.opensaml.saml.saml1.core.NameIdentifier;
+import org.opensaml.saml.saml1.core.Subject;
+import org.opensaml.saml.saml1.core.SubjectConfirmation;
+import org.opensaml.saml.saml1.core.SubjectLocality;
+import org.opensaml.security.credential.BasicCredential;
+import org.opensaml.security.x509.BasicX509Credential;
+import org.opensaml.xmlsec.keyinfo.impl.X509KeyInfoGeneratorFactory;
+import org.opensaml.xmlsec.signature.KeyInfo;
import org.w3c.dom.Element;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Class SAML1ComponentBuilder provides builder methods that can be used
* to construct SAML v1.1 statements using the OpenSaml library.
@@ -109,7 +110,8 @@ public final class SAML1ComponentBuilder
private static volatile SAMLObjectBuilder<Action> actionElementV1Builder;
- private static volatile XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
+ private static volatile XMLObjectBuilderFactory builderFactory =
+ XMLObjectProviderRegistrySupport.getBuilderFactory();
private static volatile SAMLObjectBuilder<SubjectLocality> subjectLocalityBuilder;
@@ -156,7 +158,7 @@ public final class SAML1ComponentBuilder
*/
@SuppressWarnings("unchecked")
public static Subject createSaml1v1Subject(SubjectBean subjectBean)
- throws org.opensaml.xml.security.SecurityException, WSSecurityException {
+ throws org.opensaml.security.SecurityException, WSSecurityException {
if (subjectV1Builder == null) {
subjectV1Builder = (SAMLObjectBuilder<Subject>)
builderFactory.getBuilder(Subject.DEFAULT_ELEMENT_NAME);
@@ -181,7 +183,7 @@ public final class SAML1ComponentBuilder
ConfirmationMethod confirmationMethod = confirmationMethodV1Builder.buildObject();
nameIdentifier.setNameQualifier(subjectBean.getSubjectNameQualifier());
- nameIdentifier.setNameIdentifier(subjectBean.getSubjectName());
+ nameIdentifier.setValue(subjectBean.getSubjectName());
nameIdentifier.setFormat(subjectBean.getSubjectNameIDFormat());
String confirmationMethodStr = subjectBean.getSubjectConfirmationMethod();
@@ -208,16 +210,16 @@ public final class SAML1ComponentBuilder
* @throws org.opensaml.xml.security.SecurityException
*/
public static KeyInfo createKeyInfo(KeyInfoBean keyInfo)
- throws org.opensaml.xml.security.SecurityException, WSSecurityException {
+ throws org.opensaml.security.SecurityException, WSSecurityException {
if (keyInfo.getElement() != null) {
return (KeyInfo)OpenSAMLUtil.fromDom(keyInfo.getElement());
} else {
// Set the certificate or public key
- BasicX509Credential keyInfoCredential = new BasicX509Credential();
+ BasicCredential keyInfoCredential = null;
if (keyInfo.getCertificate() != null) {
- keyInfoCredential.setEntityCertificate(keyInfo.getCertificate());
+ keyInfoCredential = new BasicX509Credential(keyInfo.getCertificate());
} else if (keyInfo.getPublicKey() != null) {
- keyInfoCredential.setPublicKey(keyInfo.getPublicKey());
+ keyInfoCredential = new BasicCredential(keyInfo.getPublicKey());
}
// Configure how to emit the certificate
@@ -380,7 +382,7 @@ public final class SAML1ComponentBuilder
@SuppressWarnings("unchecked")
public static List<AuthenticationStatement> createSamlv1AuthenticationStatement(
List<AuthenticationStatementBean> authBeans
- ) throws org.opensaml.xml.security.SecurityException, WSSecurityException {
+ ) throws org.opensaml.security.SecurityException, WSSecurityException {
List<AuthenticationStatement> authenticationStatements =
new ArrayList<AuthenticationStatement>();
@@ -460,7 +462,7 @@ public final class SAML1ComponentBuilder
@SuppressWarnings("unchecked")
public static List<AttributeStatement> createSamlv1AttributeStatement(
List<AttributeStatementBean> attributeData
- ) throws org.opensaml.xml.security.SecurityException, WSSecurityException {
+ ) throws org.opensaml.security.SecurityException, WSSecurityException {
if (attributeStatementV1Builder == null) {
attributeStatementV1Builder = (SAMLObjectBuilder<AttributeStatement>)
builderFactory.getBuilder(AttributeStatement.DEFAULT_ELEMENT_NAME);
@@ -544,7 +546,7 @@ public final class SAML1ComponentBuilder
@SuppressWarnings("unchecked")
public static List<AuthorizationDecisionStatement> createSamlv1AuthorizationDecisionStatement(
List<AuthDecisionStatementBean> decisionData)
- throws org.opensaml.xml.security.SecurityException, WSSecurityException {
+ throws org.opensaml.security.SecurityException, WSSecurityException {
List<AuthorizationDecisionStatement> authDecisionStatements =
new ArrayList<AuthorizationDecisionStatement>();
if (authorizationDecisionStatementV1Builder == null) {
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/builder/SAML2ComponentBuilder.java Thu Feb 12 12:11:02 2015
@@ -39,40 +39,40 @@ import org.apache.wss4j.common.saml.bean
import org.apache.wss4j.common.saml.bean.SubjectLocalityBean;
import org.apache.xml.security.stax.impl.util.IDGenerator;
import org.joda.time.DateTime;
-import org.opensaml.Configuration;
-import org.opensaml.common.SAMLObjectBuilder;
-import org.opensaml.common.SAMLVersion;
-import org.opensaml.saml2.core.Action;
-import org.opensaml.saml2.core.Advice;
-import org.opensaml.saml2.core.Assertion;
-import org.opensaml.saml2.core.AssertionIDRef;
-import org.opensaml.saml2.core.AssertionURIRef;
-import org.opensaml.saml2.core.Attribute;
-import org.opensaml.saml2.core.AttributeStatement;
-import org.opensaml.saml2.core.AttributeValue;
-import org.opensaml.saml2.core.Audience;
-import org.opensaml.saml2.core.AudienceRestriction;
-import org.opensaml.saml2.core.AuthnContext;
-import org.opensaml.saml2.core.AuthnContextClassRef;
-import org.opensaml.saml2.core.AuthnStatement;
-import org.opensaml.saml2.core.AuthzDecisionStatement;
-import org.opensaml.saml2.core.Conditions;
-import org.opensaml.saml2.core.DecisionTypeEnumeration;
-import org.opensaml.saml2.core.Evidence;
-import org.opensaml.saml2.core.Issuer;
-import org.opensaml.saml2.core.KeyInfoConfirmationDataType;
-import org.opensaml.saml2.core.NameID;
-import org.opensaml.saml2.core.OneTimeUse;
-import org.opensaml.saml2.core.ProxyRestriction;
-import org.opensaml.saml2.core.Subject;
-import org.opensaml.saml2.core.SubjectConfirmation;
-import org.opensaml.saml2.core.SubjectConfirmationData;
-import org.opensaml.saml2.core.SubjectLocality;
-import org.opensaml.xml.XMLObject;
-import org.opensaml.xml.XMLObjectBuilderFactory;
-import org.opensaml.xml.schema.XSString;
-import org.opensaml.xml.schema.impl.XSStringBuilder;
-import org.opensaml.xml.signature.KeyInfo;
+import org.opensaml.saml.common.SAMLObjectBuilder;
+import org.opensaml.saml.common.SAMLVersion;
+import org.opensaml.saml.saml2.core.Action;
+import org.opensaml.saml.saml2.core.Advice;
+import org.opensaml.saml.saml2.core.Assertion;
+import org.opensaml.saml.saml2.core.AssertionIDRef;
+import org.opensaml.saml.saml2.core.AssertionURIRef;
+import org.opensaml.saml.saml2.core.Attribute;
+import org.opensaml.saml.saml2.core.AttributeStatement;
+import org.opensaml.saml.saml2.core.AttributeValue;
+import org.opensaml.saml.saml2.core.Audience;
+import org.opensaml.saml.saml2.core.AudienceRestriction;
+import org.opensaml.saml.saml2.core.AuthnContext;
+import org.opensaml.saml.saml2.core.AuthnContextClassRef;
+import org.opensaml.saml.saml2.core.AuthnStatement;
+import org.opensaml.saml.saml2.core.AuthzDecisionStatement;
+import org.opensaml.saml.saml2.core.Conditions;
+import org.opensaml.saml.saml2.core.DecisionTypeEnumeration;
+import org.opensaml.saml.saml2.core.Evidence;
+import org.opensaml.saml.saml2.core.Issuer;
+import org.opensaml.saml.saml2.core.KeyInfoConfirmationDataType;
+import org.opensaml.saml.saml2.core.NameID;
+import org.opensaml.saml.saml2.core.OneTimeUse;
+import org.opensaml.saml.saml2.core.ProxyRestriction;
+import org.opensaml.saml.saml2.core.Subject;
+import org.opensaml.saml.saml2.core.SubjectConfirmation;
+import org.opensaml.saml.saml2.core.SubjectConfirmationData;
+import org.opensaml.saml.saml2.core.SubjectLocality;
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.XMLObjectBuilderFactory;
+import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
+import org.opensaml.core.xml.schema.XSString;
+import org.opensaml.core.xml.schema.impl.XSStringBuilder;
+import org.opensaml.xmlsec.signature.KeyInfo;
import org.w3c.dom.Element;
/**
@@ -126,7 +126,8 @@ public final class SAML2ComponentBuilder
private static volatile SAMLObjectBuilder<Action> actionElementBuilder;
- private static volatile XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
+ private static volatile XMLObjectBuilderFactory builderFactory =
+ XMLObjectProviderRegistrySupport.getBuilderFactory();
private static volatile SAMLObjectBuilder<SubjectLocality> subjectLocalityBuilder;
@@ -506,7 +507,7 @@ public final class SAML2ComponentBuilder
*/
@SuppressWarnings("unchecked")
public static Subject createSaml2Subject(SubjectBean subjectBean)
- throws org.opensaml.xml.security.SecurityException, WSSecurityException {
+ throws org.opensaml.security.SecurityException, WSSecurityException {
if (subjectBuilder == null) {
subjectBuilder = (SAMLObjectBuilder<Subject>)
builderFactory.getBuilder(Subject.DEFAULT_ELEMENT_NAME);
@@ -549,7 +550,7 @@ public final class SAML2ComponentBuilder
public static SubjectConfirmationData createSubjectConfirmationData(
SubjectConfirmationDataBean subjectConfirmationDataBean,
KeyInfoBean keyInfoBean
- ) throws org.opensaml.xml.security.SecurityException, WSSecurityException {
+ ) throws org.opensaml.security.SecurityException, WSSecurityException {
SubjectConfirmationData subjectConfirmationData = null;
KeyInfo keyInfo = null;
if (keyInfoBean == null) {
Modified: webservices/wss4j/trunk/ws-security-dom/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/pom.xml?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/pom.xml (original)
+++ webservices/wss4j/trunk/ws-security-dom/pom.xml Thu Feb 12 12:11:02 2015
@@ -23,12 +23,12 @@
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-parent</artifactId>
<relativePath>../parent/pom.xml</relativePath>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-ws-security-dom</artifactId>
<name>Apache WSS4J DOM WS-Security</name>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<properties>
<wss4j.osgi.dynamic.import>
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java Thu Feb 12 12:11:02 2015
@@ -33,12 +33,10 @@ import javax.xml.crypto.dsig.XMLValidate
import javax.xml.crypto.dsig.dom.DOMValidateContext;
import javax.xml.namespace.QName;
-import org.w3c.dom.Element;
-
-import org.apache.wss4j.common.principal.SAMLTokenPrincipalImpl;
import org.apache.wss4j.common.crypto.AlgorithmSuite;
import org.apache.wss4j.common.crypto.AlgorithmSuiteValidator;
import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.common.principal.SAMLTokenPrincipalImpl;
import org.apache.wss4j.common.saml.SAMLKeyInfo;
import org.apache.wss4j.common.saml.SAMLUtil;
import org.apache.wss4j.common.saml.SamlAssertionWrapper;
@@ -51,8 +49,9 @@ import org.apache.wss4j.dom.handler.Requ
import org.apache.wss4j.dom.saml.WSSSAMLKeyInfoProcessor;
import org.apache.wss4j.dom.validate.Credential;
import org.apache.wss4j.dom.validate.Validator;
-import org.opensaml.xml.signature.KeyInfo;
-import org.opensaml.xml.signature.Signature;
+import org.opensaml.xmlsec.signature.KeyInfo;
+import org.opensaml.xmlsec.signature.Signature;
+import org.w3c.dom.Element;
public class SAMLTokenProcessor implements Processor {
private static final org.slf4j.Logger LOG =
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SamlAssertionValidator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SamlAssertionValidator.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SamlAssertionValidator.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SamlAssertionValidator.java Thu Feb 12 12:11:02 2015
@@ -31,7 +31,7 @@ import org.apache.wss4j.common.saml.buil
import org.apache.wss4j.common.saml.builder.SAML2Constants;
import org.apache.wss4j.dom.handler.RequestData;
import org.joda.time.DateTime;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
/**
* This class validates a SAML Assertion, which is wrapped in an "SamlAssertionWrapper" instance.
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomSamlAssertionValidator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomSamlAssertionValidator.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomSamlAssertionValidator.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomSamlAssertionValidator.java Thu Feb 12 12:11:02 2015
@@ -40,22 +40,22 @@ public class CustomSamlAssertionValidato
}
if (samlAssertion.getSaml1() != null) {
// Get the SAML subject and validate it
- org.opensaml.saml1.core.Assertion saml1Assertion = samlAssertion.getSaml1();
- org.opensaml.saml1.core.Subject samlSubject = null;
- for (org.opensaml.saml1.core.Statement stmt : saml1Assertion.getStatements()) {
- if (stmt instanceof org.opensaml.saml1.core.AttributeStatement) {
- org.opensaml.saml1.core.AttributeStatement attrStmt =
- (org.opensaml.saml1.core.AttributeStatement) stmt;
+ org.opensaml.saml.saml1.core.Assertion saml1Assertion = samlAssertion.getSaml1();
+ org.opensaml.saml.saml1.core.Subject samlSubject = null;
+ for (org.opensaml.saml.saml1.core.Statement stmt : saml1Assertion.getStatements()) {
+ if (stmt instanceof org.opensaml.saml.saml1.core.AttributeStatement) {
+ org.opensaml.saml.saml1.core.AttributeStatement attrStmt =
+ (org.opensaml.saml.saml1.core.AttributeStatement) stmt;
samlSubject = attrStmt.getSubject();
break;
- } else if (stmt instanceof org.opensaml.saml1.core.AuthenticationStatement) {
- org.opensaml.saml1.core.AuthenticationStatement authStmt =
- (org.opensaml.saml1.core.AuthenticationStatement) stmt;
+ } else if (stmt instanceof org.opensaml.saml.saml1.core.AuthenticationStatement) {
+ org.opensaml.saml.saml1.core.AuthenticationStatement authStmt =
+ (org.opensaml.saml.saml1.core.AuthenticationStatement) stmt;
samlSubject = authStmt.getSubject();
break;
} else {
- org.opensaml.saml1.core.AuthorizationDecisionStatement authzStmt =
- (org.opensaml.saml1.core.AuthorizationDecisionStatement)stmt;
+ org.opensaml.saml.saml1.core.AuthorizationDecisionStatement authzStmt =
+ (org.opensaml.saml.saml1.core.AuthorizationDecisionStatement)stmt;
samlSubject = authzStmt.getSubject();
}
}
@@ -66,13 +66,13 @@ public class CustomSamlAssertionValidato
"for Signature (no Subject)"
);
}
- String nameIdentifier = samlSubject.getNameIdentifier().getNameIdentifier();
+ String nameIdentifier = samlSubject.getNameIdentifier().getValue();
if (nameIdentifier == null || !nameIdentifier.contains("uid=joe")) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity");
}
} else {
- org.opensaml.saml2.core.Assertion saml2Assertion = samlAssertion.getSaml2();
- org.opensaml.saml2.core.Subject subject = saml2Assertion.getSubject();
+ org.opensaml.saml.saml2.core.Assertion saml2Assertion = samlAssertion.getSaml2();
+ org.opensaml.saml.saml2.core.Subject subject = saml2Assertion.getSubject();
String nameIdentifier = subject.getNameID().getValue();
if (nameIdentifier == null || !nameIdentifier.contains("uid=joe")) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity");
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java Thu Feb 12 12:11:02 2015
@@ -28,7 +28,7 @@ import org.apache.wss4j.common.saml.bean
import org.apache.wss4j.common.saml.bean.KeyInfoBean;
import org.apache.wss4j.common.saml.bean.SubjectBean;
import org.apache.wss4j.common.saml.builder.SAML1Constants;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java Thu Feb 12 12:11:02 2015
@@ -27,7 +27,7 @@ import org.apache.wss4j.common.saml.bean
import org.apache.wss4j.common.saml.bean.KeyInfoBean;
import org.apache.wss4j.common.saml.bean.SubjectBean;
import org.apache.wss4j.common.saml.builder.SAML1Constants;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.UnsupportedCallbackException;
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java Thu Feb 12 12:11:02 2015
@@ -27,10 +27,11 @@ import org.apache.wss4j.common.saml.bean
import org.apache.wss4j.common.saml.bean.KeyInfoBean;
import org.apache.wss4j.common.saml.bean.SubjectBean;
import org.apache.wss4j.common.saml.builder.SAML2Constants;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.UnsupportedCallbackException;
+
import java.io.IOException;
/**
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java Thu Feb 12 12:11:02 2015
@@ -44,7 +44,7 @@ import org.apache.wss4j.common.util.Load
import org.apache.wss4j.common.util.XMLUtils;
import org.apache.wss4j.dom.message.WSSecHeader;
import org.apache.wss4j.dom.message.WSSecSAMLToken;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import org.w3c.dom.Document;
import javax.security.auth.callback.Callback;
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java Thu Feb 12 12:11:02 2015
@@ -70,14 +70,14 @@ import org.apache.xml.security.encryptio
import org.apache.xml.security.keys.KeyInfo;
import org.apache.xml.security.keys.content.X509Data;
import org.joda.time.DateTime;
-import org.opensaml.Configuration;
-import org.opensaml.common.SAMLObjectBuilder;
-import org.opensaml.saml2.core.AttributeValue;
-import org.opensaml.saml2.core.Conditions;
-import org.opensaml.xml.XMLObjectBuilder;
-import org.opensaml.xml.XMLObjectBuilderFactory;
-import org.opensaml.xml.schema.XSAny;
-import org.opensaml.xml.schema.XSInteger;
+import org.opensaml.core.xml.XMLObjectBuilder;
+import org.opensaml.core.xml.XMLObjectBuilderFactory;
+import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
+import org.opensaml.core.xml.schema.XSAny;
+import org.opensaml.core.xml.schema.XSInteger;
+import org.opensaml.saml.common.SAMLObjectBuilder;
+import org.opensaml.saml.saml2.core.AttributeValue;
+import org.opensaml.saml.saml2.core.Conditions;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -567,7 +567,8 @@ public class SamlTokenTest extends org.j
callbackHandler.setIssuer("www.example.com");
// Create and add a custom Attribute (conditions Object)
- XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
+ XMLObjectBuilderFactory builderFactory =
+ XMLObjectProviderRegistrySupport.getBuilderFactory();
SAMLObjectBuilder<Conditions> conditionsV2Builder =
(SAMLObjectBuilder<Conditions>)builderFactory.getBuilder(Conditions.DEFAULT_ELEMENT_NAME);
@@ -576,7 +577,8 @@ public class SamlTokenTest extends org.j
conditions.setNotBefore(newNotBefore);
conditions.setNotOnOrAfter(newNotBefore.plusMinutes(5));
- XMLObjectBuilder<XSAny> xsAnyBuilder = builderFactory.getBuilder(XSAny.TYPE_NAME);
+ XMLObjectBuilder<XSAny> xsAnyBuilder =
+ (XMLObjectBuilder<XSAny>)builderFactory.getBuilder(XSAny.TYPE_NAME);
XSAny attributeValue = xsAnyBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME);
attributeValue.getUnknownXMLObjects().add(conditions);
@@ -624,9 +626,10 @@ public class SamlTokenTest extends org.j
callbackHandler.setIssuer("www.example.com");
// Create and add a custom Attribute (Integer)
- XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
+ XMLObjectBuilderFactory builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();
- XMLObjectBuilder<XSInteger> xsIntegerBuilder = builderFactory.getBuilder(XSInteger.TYPE_NAME);
+ XMLObjectBuilder<XSInteger> xsIntegerBuilder =
+ (XMLObjectBuilder<XSInteger>)builderFactory.getBuilder(XSInteger.TYPE_NAME);
XSInteger attributeValue =
xsIntegerBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSInteger.TYPE_NAME);
attributeValue.setValue(5);
Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java Thu Feb 12 12:11:02 2015
@@ -24,22 +24,22 @@ import java.security.KeyStore;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.wss4j.dom.WSSConfig;
-import org.apache.wss4j.dom.common.SAML2CallbackHandler;
-import org.apache.wss4j.dom.common.SecurityTestUtil;
import org.apache.wss4j.common.crypto.Crypto;
import org.apache.wss4j.common.crypto.CryptoType;
import org.apache.wss4j.common.crypto.Merlin;
-import org.apache.wss4j.common.saml.SAMLKeyInfo;
-import org.apache.wss4j.common.saml.SamlAssertionWrapper;
import org.apache.wss4j.common.saml.SAMLCallback;
+import org.apache.wss4j.common.saml.SAMLKeyInfo;
import org.apache.wss4j.common.saml.SAMLUtil;
+import org.apache.wss4j.common.saml.SamlAssertionWrapper;
import org.apache.wss4j.common.saml.builder.SAML2Constants;
import org.apache.wss4j.common.util.DOM2Writer;
import org.apache.wss4j.common.util.Loader;
+import org.apache.wss4j.dom.WSSConfig;
+import org.apache.wss4j.dom.common.SAML2CallbackHandler;
+import org.apache.wss4j.dom.common.SecurityTestUtil;
import org.junit.Assert;
-import org.opensaml.xml.signature.Signature;
-import org.opensaml.xml.signature.SignatureConstants;
+import org.opensaml.xmlsec.signature.Signature;
+import org.opensaml.xmlsec.signature.support.SignatureConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified: webservices/wss4j/trunk/ws-security-policy-stax/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/pom.xml?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/pom.xml (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/pom.xml Thu Feb 12 12:11:02 2015
@@ -24,11 +24,11 @@
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-parent</artifactId>
<relativePath>../parent/pom.xml</relativePath>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-ws-security-policy-stax</artifactId>
- <version>2.0.4-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<name>Apache WSS4J Streaming WS-SecurityPolicy</name>
<dependencies>
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/IssuedTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/IssuedTokenAssertionState.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/IssuedTokenAssertionState.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/IssuedTokenAssertionState.java Thu Feb 12 12:11:02 2015
@@ -34,7 +34,7 @@ import org.apache.xml.security.stax.secu
import org.apache.xml.security.stax.securityToken.SecurityToken;
import org.apache.wss4j.stax.securityEvent.IssuedTokenSecurityEvent;
import org.apache.wss4j.stax.securityEvent.WSSecurityEventConstants;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -236,16 +236,16 @@ public class IssuedTokenAssertionState e
return "Unsupported SAML version";
}
- protected String findClaimInAssertion(org.opensaml.saml2.core.Assertion assertion, URI claimURI) {
- List<org.opensaml.saml2.core.AttributeStatement> attributeStatements =
+ protected String findClaimInAssertion(org.opensaml.saml.saml2.core.Assertion assertion, URI claimURI) {
+ List<org.opensaml.saml.saml2.core.AttributeStatement> attributeStatements =
assertion.getAttributeStatements();
if (attributeStatements == null || attributeStatements.isEmpty()) {
return "Attribute " + claimURI + " not found in the SAMLAssertion";
}
- for (org.opensaml.saml2.core.AttributeStatement statement : attributeStatements) {
- List<org.opensaml.saml2.core.Attribute> attributes = statement.getAttributes();
- for (org.opensaml.saml2.core.Attribute attribute : attributes) {
+ for (org.opensaml.saml.saml2.core.AttributeStatement statement : attributeStatements) {
+ List<org.opensaml.saml.saml2.core.Attribute> attributes = statement.getAttributes();
+ for (org.opensaml.saml.saml2.core.Attribute attribute : attributes) {
if (attribute.getName().equals(claimURI.toString())
&& attribute.getAttributeValues() != null && !attribute.getAttributeValues().isEmpty()) {
@@ -256,17 +256,17 @@ public class IssuedTokenAssertionState e
return "Attribute " + claimURI + " not found in the SAMLAssertion";
}
- protected String findClaimInAssertion(org.opensaml.saml1.core.Assertion assertion, URI claimURI) {
- List<org.opensaml.saml1.core.AttributeStatement> attributeStatements =
+ protected String findClaimInAssertion(org.opensaml.saml.saml1.core.Assertion assertion, URI claimURI) {
+ List<org.opensaml.saml.saml1.core.AttributeStatement> attributeStatements =
assertion.getAttributeStatements();
if (attributeStatements == null || attributeStatements.isEmpty()) {
return "Attribute " + claimURI + " not found in the SAMLAssertion";
}
- for (org.opensaml.saml1.core.AttributeStatement statement : attributeStatements) {
+ for (org.opensaml.saml.saml1.core.AttributeStatement statement : attributeStatements) {
- List<org.opensaml.saml1.core.Attribute> attributes = statement.getAttributes();
- for (org.opensaml.saml1.core.Attribute attribute : attributes) {
+ List<org.opensaml.saml.saml1.core.Attribute> attributes = statement.getAttributes();
+ for (org.opensaml.saml.saml1.core.Attribute attribute : attributes) {
URI attributeNamespace = URI.create(attribute.getAttributeNamespace());
String desiredRole = attributeNamespace.relativize(claimURI).toString();
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/SamlTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/SamlTokenAssertionState.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/SamlTokenAssertionState.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/SamlTokenAssertionState.java Thu Feb 12 12:11:02 2015
@@ -29,7 +29,7 @@ import org.apache.wss4j.policy.model.Sam
import org.apache.wss4j.policy.stax.PolicyAsserter;
import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import org.apache.wss4j.stax.securityEvent.SamlTokenSecurityEvent;
import org.apache.wss4j.stax.securityEvent.WSSecurityEventConstants;
import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java Thu Feb 12 12:11:02 2015
@@ -23,7 +23,7 @@ import org.apache.wss4j.stax.securityTok
import org.apache.xml.security.stax.config.Init;
import org.junit.Assert;
import org.junit.Test;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.common.saml.builder.SAML2Constants;
import org.apache.wss4j.common.bsp.BSPRule;
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/IssuedTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/IssuedTokenTest.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/IssuedTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/IssuedTokenTest.java Thu Feb 12 12:11:02 2015
@@ -33,7 +33,7 @@ import org.apache.wss4j.stax.securityEve
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
import org.junit.Assert;
import org.junit.Test;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import org.apache.wss4j.policy.stax.PolicyEnforcer;
import org.apache.wss4j.stax.ext.WSSConstants;
import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SamlTokenTest.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SamlTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SamlTokenTest.java Thu Feb 12 12:11:02 2015
@@ -26,7 +26,7 @@ import org.apache.wss4j.stax.impl.securi
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
import org.junit.Assert;
import org.junit.Test;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.apache.wss4j.policy.stax.PolicyEnforcer;
import org.apache.wss4j.policy.stax.PolicyViolationException;
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java?rev=1659234&r1=1659233&r2=1659234&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java Thu Feb 12 12:11:02 2015
@@ -28,7 +28,7 @@ import org.apache.wss4j.stax.impl.securi
import org.apache.xml.security.stax.impl.util.IDGenerator;
import org.junit.Assert;
import org.junit.Test;
-import org.opensaml.common.SAMLVersion;
+import org.opensaml.saml.common.SAMLVersion;
import org.apache.wss4j.policy.stax.PolicyEnforcer;
import org.apache.wss4j.stax.ext.WSSConstants;
import org.apache.wss4j.stax.securityEvent.*;