ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1660123 - in /webservices/wss4j/branches/2_0_x-fixes: ws-security-common/src/main/java/org/apache/wss4j/common/saml/ ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/ ws-security-dom/src/test/java/org/apache/wss4j/dom/com...
Date Mon, 16 Feb 2015 14:12:50 GMT
Author: coheigea
Date: Mon Feb 16 14:12:50 2015
New Revision: 1660123

URL: http://svn.apache.org/r1660123
Log:
Add a new way to specify SAML Versions in CallbackHandlers


Conflicts:
	ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java
	ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java
	ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java
	ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java
	ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java

Added:
    webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/Version.java
Modified:
    webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java
    webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java
    webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java
    webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java
    webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java?rev=1660123&r1=1660122&r2=1660123&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java
(original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLCallback.java
Mon Feb 16 14:12:50 2015
@@ -27,6 +27,7 @@ import org.apache.wss4j.common.saml.bean
 import org.apache.wss4j.common.saml.bean.ConditionsBean;
 import org.apache.wss4j.common.saml.bean.SubjectBean;
 import org.opensaml.common.SAMLVersion;
+import org.apache.wss4j.common.saml.bean.Version;
 import org.w3c.dom.Element;
 
 import javax.security.auth.callback.Callback;
@@ -268,6 +269,7 @@ public class SAMLCallback implements Cal
      * Set the SAMLVersion of the assertion to create
      * @param samlVersion the SAMLVersion of the assertion to create
      */
+    @Deprecated
     public void setSamlVersion(SAMLVersion samlVersion) {
         this.samlVersion = samlVersion;
     }
@@ -281,6 +283,20 @@ public class SAMLCallback implements Cal
     }
     
     /**
+     * Set the SAML Version of the assertion to create
+     * @param samlVersion the SAML Version of the assertion to create
+     */
+    public void setSamlVersion(Version samlVersion) {
+        if (samlVersion == Version.SAML_20) {
+            this.samlVersion = SAMLVersion.VERSION_20;
+        } else if (samlVersion == Version.SAML_11) {
+            this.samlVersion = SAMLVersion.VERSION_11;
+        } else if (samlVersion == Version.SAML_10) {
+            this.samlVersion = SAMLVersion.VERSION_10;
+        }
+    }
+    
+    /**
      * Set the DOM representation of this SAML Assertion
      * @param assertionElement the DOM representation of this SAML Assertion
      */

Added: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/Version.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/Version.java?rev=1660123&view=auto
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/Version.java
(added)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/Version.java
Mon Feb 16 14:12:50 2015
@@ -0,0 +1,30 @@
+/**
+ * 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.bean;
+
+
+/**
+ * The SAML Version
+ */
+public enum Version {
+    
+    SAML_20, SAML_11, SAML_10;
+
+}

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java?rev=1660123&r1=1660122&r2=1660123&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java
(original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1AuthnHOKHandler.java
Mon Feb 16 14:12:50 2015
@@ -27,12 +27,13 @@ import org.apache.wss4j.common.saml.SAML
 import org.apache.wss4j.common.saml.bean.AuthenticationStatementBean;
 import org.apache.wss4j.common.saml.bean.KeyInfoBean;
 import org.apache.wss4j.common.saml.bean.SubjectBean;
+import org.apache.wss4j.common.saml.bean.Version;
 import org.apache.wss4j.common.saml.builder.SAML1Constants;
-import org.opensaml.common.SAMLVersion;
 
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.UnsupportedCallbackException;
+
 import java.io.IOException;
 import java.security.cert.X509Certificate;
 import java.util.Collections;
@@ -59,7 +60,7 @@ public class SAML1AuthnHOKHandler implem
         for (int i = 0; i < callbacks.length; i++) {
             if (callbacks[i] instanceof SAMLCallback) {
                 SAMLCallback callback = (SAMLCallback) callbacks[i];
-                callback.setSamlVersion(SAMLVersion.VERSION_11);
+                callback.setSamlVersion(Version.SAML_11);
                 SubjectBean subjectBean = 
                     new SubjectBean(
                         subjectName, subjectQualifier, SAML1Constants.CONF_HOLDER_KEY

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java?rev=1660123&r1=1660122&r2=1660123&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java
(original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML1CallbackHandler.java
Mon Feb 16 14:12:50 2015
@@ -26,8 +26,8 @@ import org.apache.wss4j.common.saml.SAML
 import org.apache.wss4j.common.saml.bean.AdviceBean;
 import org.apache.wss4j.common.saml.bean.KeyInfoBean;
 import org.apache.wss4j.common.saml.bean.SubjectBean;
+import org.apache.wss4j.common.saml.bean.Version;
 import org.apache.wss4j.common.saml.builder.SAML1Constants;
-import org.opensaml.common.SAMLVersion;
 
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.UnsupportedCallbackException;
@@ -59,7 +59,7 @@ public class SAML1CallbackHandler extend
         for (int i = 0; i < callbacks.length; i++) {
             if (callbacks[i] instanceof SAMLCallback) {
                 SAMLCallback callback = (SAMLCallback) callbacks[i];
-                callback.setSamlVersion(SAMLVersion.VERSION_11);
+                callback.setSamlVersion(Version.SAML_11);
                 callback.setIssuer(issuer);
                 if (conditions != null) {
                     callback.setConditions(conditions);

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java?rev=1660123&r1=1660122&r2=1660123&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java
(original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SAML2CallbackHandler.java
Mon Feb 16 14:12:50 2015
@@ -26,8 +26,8 @@ import org.apache.wss4j.common.saml.SAML
 import org.apache.wss4j.common.saml.bean.AdviceBean;
 import org.apache.wss4j.common.saml.bean.KeyInfoBean;
 import org.apache.wss4j.common.saml.bean.SubjectBean;
+import org.apache.wss4j.common.saml.bean.Version;
 import org.apache.wss4j.common.saml.builder.SAML2Constants;
-import org.opensaml.common.SAMLVersion;
 
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.UnsupportedCallbackException;
@@ -57,7 +57,7 @@ public class SAML2CallbackHandler extend
         for (int i = 0; i < callbacks.length; i++) {
             if (callbacks[i] instanceof SAMLCallback) {
                 SAMLCallback callback = (SAMLCallback) callbacks[i];
-                callback.setSamlVersion(SAMLVersion.VERSION_20);
+                callback.setSamlVersion(Version.SAML_20);
                 callback.setIssuer(issuer);
                 if (conditions != null) {
                     callback.setConditions(conditions);

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java?rev=1660123&r1=1660122&r2=1660123&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java
(original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java
Mon Feb 16 14:12:50 2015
@@ -38,13 +38,13 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.common.saml.SAMLCallback;
 import org.apache.wss4j.common.saml.SAMLUtil;
 import org.apache.wss4j.common.saml.bean.SubjectBean;
+import org.apache.wss4j.common.saml.bean.Version;
 import org.apache.wss4j.common.saml.builder.SAML1Constants;
 import org.apache.wss4j.common.saml.builder.SAML2Constants;
 import org.apache.wss4j.common.util.Loader;
 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.w3c.dom.Document;
 
 import javax.security.auth.callback.Callback;
@@ -424,7 +424,7 @@ public class SamlNegativeTest extends or
                             subjectName, subjectQualifier, confirmationMethod
                         );
                     createAndSetStatement(subjectBean, callback);
-                    callback.setSamlVersion(SAMLVersion.VERSION_11);
+                    callback.setSamlVersion(Version.SAML_11);
                 } else {
                     throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
                 }



Mime
View raw message