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/09/09 12:04:41 UTC

svn commit: r1701969 - in /webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos: KerberosClientExceptionAction.java KerberosServiceExceptionAction.java

Author: coheigea
Date: Wed Sep  9 10:04:40 2015
New Revision: 1701969

URL: http://svn.apache.org/r1701969
Log:
[WSS-552] - The KerberosServiceExceptionAction and KerberosClientExceptionAction do not support HP JDK. Thanks to Esin Yakub for the patch.

Modified:
    webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java
    webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java?rev=1701969&r1=1701968&r2=1701969&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java Wed Sep  9 10:04:40 2015
@@ -43,7 +43,8 @@ public class KerberosClientExceptionActi
     private static final boolean isJava5Or6 = javaVersion.startsWith("1.5") || javaVersion.startsWith("1.6");
     private static final boolean isOracleJavaVendor = System.getProperty("java.vendor").startsWith("Oracle");
     private static final boolean isIBMJavaVendor = System.getProperty("java.vendor").startsWith("IBM");
-
+    private static final boolean isHPJavaVendor = System.getProperty("java.vendor").startsWith("Hewlett-Packard");
+	
     private static final String SUN_JGSS_INQUIRE_TYPE_CLASS = "com.sun.security.jgss.InquireType";
     private static final String SUN_JGSS_EXT_GSSCTX_CLASS = "com.sun.security.jgss.ExtendedGSSContext";
 
@@ -116,13 +117,13 @@ public class KerberosClientExceptionActi
         krbCtx.setGssContext(secContext);
         krbCtx.setKerberosToken(returnedToken);
 
-        if (!isJava5Or6 && (isOracleJavaVendor || isIBMJavaVendor)) {
+        if (!isJava5Or6 && (isOracleJavaVendor || isIBMJavaVendor  || isHPJavaVendor)) {
             try {
                 @SuppressWarnings("rawtypes")
-                Class inquireType = Class.forName(isOracleJavaVendor ? SUN_JGSS_INQUIRE_TYPE_CLASS : IBM_JGSS_INQUIRE_TYPE_CLASS);
+                Class inquireType = Class.forName(isIBMJavaVendor ? IBM_JGSS_INQUIRE_TYPE_CLASS : SUN_JGSS_INQUIRE_TYPE_CLASS);
 
                 @SuppressWarnings("rawtypes")
-                Class extendedGSSContext = Class.forName(isOracleJavaVendor ? SUN_JGSS_EXT_GSSCTX_CLASS : IBM_JGSS_EXT_GSSCTX_CLASS);
+                Class extendedGSSContext = Class.forName(isIBMJavaVendor ? IBM_JGSS_EXT_GSSCTX_CLASS : SUN_JGSS_EXT_GSSCTX_CLASS);
 
                 @SuppressWarnings("unchecked")
                 Method inquireSecContext = extendedGSSContext.getMethod("inquireSecContext", inquireType);

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java?rev=1701969&r1=1701968&r2=1701969&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java Wed Sep  9 10:04:40 2015
@@ -41,6 +41,7 @@ public class KerberosServiceExceptionAct
     private static final boolean isJava5Or6 = javaVersion.startsWith("1.5") || javaVersion.startsWith("1.6");
     private static final boolean isOracleJavaVendor = System.getProperty("java.vendor").startsWith("Oracle");
     private static final boolean isIBMJavaVendor = System.getProperty("java.vendor").startsWith("IBM");
+    private static final boolean isHPJavaVendor = System.getProperty("java.vendor").startsWith("Hewlett-Packard");
 
     private static final String SUN_JGSS_INQUIRE_TYPE_CLASS = "com.sun.security.jgss.InquireType";
     private static final String SUN_JGSS_EXT_GSSCTX_CLASS = "com.sun.security.jgss.ExtendedGSSContext";
@@ -108,13 +109,13 @@ public class KerberosServiceExceptionAct
             krbServiceCtx.setGssContext(secContext);
             krbServiceCtx.setKerberosToken(returnedToken);
             
-            if (!isJava5Or6 && (isOracleJavaVendor || isIBMJavaVendor)) {
+            if (!isJava5Or6 && (isOracleJavaVendor || isIBMJavaVendor || isHPJavaVendor)) {
                 try {
                     @SuppressWarnings("rawtypes")
-                    Class inquireType = Class.forName(isOracleJavaVendor ? SUN_JGSS_INQUIRE_TYPE_CLASS : IBM_JGSS_INQUIRE_TYPE_CLASS);
+                    Class inquireType = Class.forName(isIBMJavaVendor ? IBM_JGSS_INQUIRE_TYPE_CLASS : SUN_JGSS_INQUIRE_TYPE_CLASS);
 
                     @SuppressWarnings("rawtypes")
-                    Class extendedGSSContext = Class.forName(isOracleJavaVendor ? SUN_JGSS_EXT_GSSCTX_CLASS : IBM_JGSS_EXT_GSSCTX_CLASS);
+                    Class extendedGSSContext = Class.forName(isIBMJavaVendor ? IBM_JGSS_EXT_GSSCTX_CLASS : SUN_JGSS_EXT_GSSCTX_CLASS);
 
                     @SuppressWarnings("unchecked")
                     Method inquireSecContext = extendedGSSContext.getMethod(EXTENDED_JGSS_CONTEXT_INQUIRE_SEC_CONTEXT_METHOD_NAME, inquireType);