You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2006/03/24 15:01:53 UTC

svn commit: r388527 - in /webservices/axis2/trunk/java/modules: integration/test/org/apache/axis2/om/ security/src/org/apache/axis2/security/trust/

Author: ruchithf
Date: Fri Mar 24 06:01:51 2006
New Revision: 388527

URL: http://svn.apache.org/viewcvs?rev=388527&view=rev
Log:
- Fixed the build
- Updated exception handling in the ws-trust impl


Modified:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/om/OMAttributeTest.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/STSMessageReceiver.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/om/OMAttributeTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/om/OMAttributeTest.java?rev=388527&r1=388526&r2=388527&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/om/OMAttributeTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/om/OMAttributeTest.java Fri Mar 24 06:01:51 2006
@@ -4,10 +4,10 @@
 import za.co.eskom.nrs.xmlvend.base.x20.schema.AdviceReqDocument;
 import za.co.eskom.nrs.xmlvend.base.x20.schema.MsgID;
 import za.co.eskom.nrs.xmlvend.base.x20.schema.ConfirmationAdviceReq;
-import org.apache.ws.commons.om.impl.builder.StAXOMBuilder;
-import org.apache.ws.commons.om.OMAbstractFactory;
-import org.apache.ws.commons.om.OMElement;
-import org.apache.ws.commons.om.OMAttribute;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
 import org.apache.axis2.util.StreamWrapper;
 
 import javax.xml.namespace.QName;

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java?rev=388527&r1=388526&r2=388527&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java Fri Mar 24 06:01:51 2006
@@ -19,7 +19,7 @@
 public interface Constants {
     
     public final static String WST_NS = "http://schemas.xmlsoap.org/ws/2005/02/trust";
-    public final static String WST_PREFIX = "http://schemas.xmlsoap.org/ws/2005/02/trust";
+    public final static String WST_PREFIX = "wst";
     
     //Local names
     public final static String REQUEST_TYPE_LN = "RequestType";

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/STSMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/STSMessageReceiver.java?rev=388527&r1=388526&r2=388527&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/STSMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/STSMessageReceiver.java Fri Mar 24 06:01:51 2006
@@ -16,17 +16,21 @@
 
 package org.apache.axis2.security.trust;
 
+import javax.xml.namespace.QName;
+
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
-
-import javax.xml.namespace.QName;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 public class STSMessageReceiver extends AbstractInOutSyncMessageReceiver {
-
+    
+    private Log log = LogFactory.getLog(getClass());
+    
     public void invokeBusinessLogic(MessageContext inMessage,
             MessageContext outMessage) throws AxisFault {
 
@@ -56,7 +60,9 @@
                 throw new TrustException("missingDispatcherConfiguration");
             }
         } catch (TrustException e) {
-            throw new AxisFault(e.getFaultString(), e.getFaultCode(), e);
+            //Log the exception
+            log.error(e);
+            throw new AxisFault(e.getFaultString(), e.getFaultCode());
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java?rev=388527&r1=388526&r2=388527&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java Fri Mar 24 06:01:51 2006
@@ -24,17 +24,17 @@
 
     private static final long serialVersionUID = -445341784514373965L;
 
-    public final static String INVALID_REQUEST = "wst:InvalidRequest";
-    public final static String FAILED_AUTHENTICATION = "wst:FailedAuthentication";
-    public final static String REQUEST_FAILED = "wst:RequestFailed";
-    public final static String INVALID_SECURITY_TOKEN = "wst:InvalidSecurityToken";
-    public final static String AUTHENTICATION_BAD_ELEMENTS = "wst:AuthenticationBadElements";
-    public final static String BAD_REQUEST = "wst:BadRequest";
-    public final static String EXPIRED_DATA = "wst:ExpiredData";
-    public final static String INVALID_TIME_RANGE = "wst:InvalidTimeRange";
-    public final static String INVALID_SCOPE = "wst:InvalidScope";
-    public final static String RENEW_NEEDED = "wst:RenewNeeded";
-    public final static String UNABLE_TO_RENEW = "wst:UnableToRenew";
+    public final static String INVALID_REQUEST = "InvalidRequest";
+    public final static String FAILED_AUTHENTICATION = "FailedAuthentication";
+    public final static String REQUEST_FAILED = "RequestFailed";
+    public final static String INVALID_SECURITY_TOKEN = "InvalidSecurityToken";
+    public final static String AUTHENTICATION_BAD_ELEMENTS = "AuthenticationBadElements";
+    public final static String BAD_REQUEST = "BadRequest";
+    public final static String EXPIRED_DATA = "ExpiredData";
+    public final static String INVALID_TIME_RANGE = "InvalidTimeRange";
+    public final static String INVALID_SCOPE = "InvalidScope";
+    public final static String RENEW_NEEDED = "RenewNeeded";
+    public final static String UNABLE_TO_RENEW = "UnableToRenew";
     
     
     private static ResourceBundle resources;
@@ -52,10 +52,33 @@
     
     public TrustException(String faultCode, Object[] args) {
         super(getMessage(faultCode, args));
-        this.faultCode = faultCode;
+        this.faultCode = getFaultCode(faultCode);
         this.faultString = getMessage(faultCode, args);
     }
     
+    /**
+     * Construct the fault properly code for the standard faults
+     * @param faultCode2
+     * @return
+     */
+    private String getFaultCode(String code) {
+        if(AUTHENTICATION_BAD_ELEMENTS.equals(code) ||
+           BAD_REQUEST.equals(code) ||
+           EXPIRED_DATA.equals(code) ||
+           FAILED_AUTHENTICATION.equals(code) ||
+           INVALID_REQUEST.equals(code) ||
+           INVALID_SCOPE.equals(code) ||
+           INVALID_SECURITY_TOKEN.equals(code) ||
+           INVALID_TIME_RANGE.equals(code) ||
+           RENEW_NEEDED.equals(code) ||
+           REQUEST_FAILED.equals(code) ||
+           UNABLE_TO_RENEW.equals(code)) {
+            return Constants.WST_PREFIX + ":" + code;
+        } else {
+            return code;
+        }
+    }
+
     public TrustException(String faultCode) {
         this(faultCode, (Object[])null);
     }

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties?rev=388527&r1=388526&r2=388527&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties Fri Mar 24 06:01:51 2006
@@ -1,14 +1,14 @@
-wst:InvalidRequest = The request was invalid or malformed
-wst:FailedAuthentication = Authentication failed
-wst:RequestFailed = The specified request failed
-wst:InvalidSecurityToken = Security token has been revoked
-wst:AuthenticationBadElements = Insufficient Digest Elements
-wst:BadRequest = The specified RequestSecurityToken is not understood
-wst:ExpiredData = The request data is out-of-date
-wst:InvalidTimeRange = The requested time range is invalid or unsupported
-wst:InvalidScope = The request scope is invalid or unsupported
-wst:RenewNeeded = A renewable security token has expired
-wst:UnableToRenew = The requested renewal failed
+InvalidRequest = The request was invalid or malformed
+FailedAuthentication = Authentication failed
+RequestFailed = The specified request failed
+InvalidSecurityToken = Security token has been revoked
+AuthenticationBadElements = Insufficient Digest Elements
+BadRequest = The specified RequestSecurityToken is not understood
+ExpiredData = The request data is out-of-date
+InvalidTimeRange = The requested time range is invalid or unsupported
+InvalidScope = The request scope is invalid or unsupported
+RenewNeeded = A renewable security token has expired
+UnableToRenew = The requested renewal failed
 
 
 incorrectConfiguration = The given configuration element is not a "token-dispatcher-configuration" element